Please help me find where am I doing wrong?

Правка en1, от CandidFlakes, 2023-08-12 13:49:13

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!

Теги sorting, wrong answer, debugging

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский CandidFlakes 2023-08-12 13:49:13 894 Initial revision (published)