Help Needed in HackerEarth Problem

Problem Link

could someone please help me in understanding the editorial?not able to understand what’s happening in that question