Some test cases are not passing.. please check my code

Hello !
The Idea seems fine, but I see a bug in your comparator
Imagine a case when p1.first == p2.first, in that case you need to define a condition so that you sort the value and hence on the basis of p1.second and p2.second.

Refer line 87 : https://ide.codingblocks.com/s/574693
Hope that helps ! Feel free to ask queries back : )
(please close the doubt if your doubt was resolved and rate the experience : )

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.