here is my solution to above problem, i know it is different from most of the correct answers i went through but i could not find a case where the code is going wrong. HELP TO FIND ONE. i checked many test cases by running the accepted solutions in my pc all matched with my answers.
1
10
1 2 3 4 5 6 7 8 9 10
4
For this test case your program doesn’t take the last input i.e 4
If I am wrong anywhere do prompt me
HAPPY CODING
no its working f9…
after taking the last input 4 it is correctly showing answer as 4.
Ooops …SORRY for that …Try with this test case
1
10
1 3 2 4 6 5 8 7 10 9
4
again correct… showing answer 4
I am sorry Bro !! I don’t find any problem with this … I guess @damn_me / @betlista / @pratku123 might help you