I have tried to solve this... I have tried Brute force. Can anybody provide a intuitive idea — how to solve this. The thing is here we can't divide the range in blocks as the update in the array are not consecutive. This is my first sqrt decomposition
problem.