Here’s the link to the problem : http://www.codechef.com/problems/ARRAYTRM

I haven’t come across a similar problem before, and after giving much thought to it, I am unable to arrive at a suitable approach to solve this problem. How should I proceed solving the problem?