Getting the correct output, but still when I test it , giving that the output is wrong


#1

When tried to run against the input
[137 50 2 19 54 26 24 60 9 6 41 36 -1 48 34 47 -1 -1 5 43 27 56 45 14 59 53 -1 -1 46 51 -1 -1 13 67 39 -1 64 58 1 -1 44 10 7 28 -1 -1 49 25 3 57 -1 29 -1 -1 -1 62 -1 17 20 -1 31 18 40 -1 65 52 -1 -1 68 30 21 -1 -1 35 -1 23 -1 -1 -1 -1 -1 -1 -1 -1 61 -1 15 12 -1 -1 -1 8 63 4 -1 -1 -1 -1 11 -1 -1 -1 -1 22 -1 32 -1 -1 -1 -1 -1 16 38 55 42 -1 37 -1 33 66 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1]

while running in “Test with custom input” , I am getting correct ans (9) but when clicking the “Test” button the output my function returned is shown as (14) which is wrong . Kindly please look into this problem .
I have solved this question using python
thank you


#2

you might be using global variables. clear them at the start of your function.