Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Sort the array on the basis of the attack values and group characters with the same attack together. How can you use these groups?
Characters in one group will always have a lesser attack value than the characters of the next group. Hence, we will only need to check if there is a higher defense value present in the next groups.