Only one test case is passing. What am i doing worng?

I guess, the code is right and it is showing true for all the small cases can think of.

Hey Mayank!, run your code on this testcase! you will find the mistake
4
10 20 30 40
30