Please tell me what is wrong with my code

please tell me what is wrong with my code , my sample test case is passes

please share code in cb ide

its of O(n) complexity

its of O(n) complexity i didnt try log(n) by binary search

i have submitted the code

u can view it in the submissions

4
10 2 3 4
code does not produce any output for this test case

also
image