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.
You should binary search(after sorting) for the largest kangaroo which is at least half the size of the current kangaroo
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 ?