GYM Problem
Can someone suggest an appraoch to solve problem F of this link !! http://mirror.codeforces.com/gym/100610
Leetcode Weekly 498 Solution Discussion