Amazon OA tough question
Can anyone help me solve this problem. I have no idea how to do it. I thing its subarray problem. link
Codeforces Round 1123 Solution Discussion