2 test cases are correct except 1 which is wrong. I tried with different inputs to check the code and it is giving correct answer but i cant figure out why one test case is wrong.
ide–>https://ide.codingblocks.com/s/169094
R9- Found At Last
Hello @mikkyimran,
Your code is failing for the test cases like:
7
86 -16 77 65 45 77 28
86
Reason:
Wrong base condition: if(i==0)
0 represents the first index of the array.
Solution:
if(i<0)
Modified Code:
Hope, this would help.
Give a like if you are satisfied.
thanks sir . understood my mistake