Блог пользователя CandidFlakes

Автор CandidFlakes, история, 16 месяцев назад, По-английски

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!

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
16 месяцев назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

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.