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

Автор parth_15, история, 9 лет назад, По-английски

Hello everyone, I was solving this problem but I am constantly getting WASubmission. I have used greedy approach. I first sorted the array and started checking from right to left that if we can find pair for ith index,then match up. Treeset is used for that purpose. But I am not able to find any bug. Please help.

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

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

You should binary search(after sorting) for the largest kangaroo which is at least half the size of the current kangaroo