Answer is coming right but showing wrong answer

question = https://hack.codingblocks.com/contests/c/424/1390
solution = https://ide.codingblocks.com/#/s/14950

The given sample test case should be:
1
7
5 1 9 2 5 1 7
Also, in your code bound checking inside for() loop of ā€˜jā€™ was not done. You can refer this code for it
https://ide.codingblocks.com/#/s/14977

1 Like

thank you for the help