Test case 0 and 5 failing

Test case 0 and 5 failing. Please explain why

for test case like
4
6
99999 8999565 809950 1234999
123456 777777
the correct answer is
8999565 not 8999566
array is not sorted
here is your corrrected code: