Concept not clear

I am not able to understand the logic that is being taught in this video. Please clear how this logic is done. And also comparator function topic is also not clear

hi @nitesh16 can you point out what is the thing you did not understand about the whole concept? Please tell me so I can help you better.
Also do tell the timestamp where comparator function is used

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.