parth_15's blog

By parth_15, history, 7 years ago, In English

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.

  • Vote: I like it
  • +3
  • Vote: I do not like it

»
7 years ago, # |
  Vote: I like it +1 Vote: I do not like it

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

  • »
    »
    7 years ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    But I am using the same approach. Instead of binary search, I am finding it with treeset. Can you tell me where can it fail ?