Here is the problem:
Here are the most visible solutions with same logic used everywhere. I don’t understand why this logic is getting AC.
Also it’s editorial code was difficult to grasp. Can anyone explain the logic used in editorial as well? Thanks