CandidFlakes's blog

By CandidFlakes, history, 10 months ago, In English

I am trying to solve this question. Here is my submission. One of the test case which it is failing is  But, I think my answer which is 4 for this case is correct. Let me explain this, Starting from the beginning of sorted array l, suppose that everyone who says that the number of liars is less than or equal number of people left after excluding the person who says this and excluding the people who are truth speakers must be telling the truth.

So, in this case sorted array l is {0,1,1,2,2,4,7,8,9}. Hence, following the above ideology the number of truth speakers must be 0,1,1,2,2(total 5). Hence the number of liars is 9-5=4.

Where am I doing wrong? I will be thankful for any help!

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
10 months ago, # |
  Vote: I like it +3 Vote: I do not like it

If there were $$$4$$$ liars, the truth tellers would be $$$0, 1, 1, 2, 2, 4$$$ and liars would be $$$7, 8, 9$$$. There would be only $$$3$$$ liars leading to a contradiction.