Getting index out of bounds on submitting but correct answer when testing


#1

My solution is giving Index Out of Bounds exception when I submit it, but when I run the same input using Test with custom input, it gives the correct answer. The input is 3.


#2

check if your global variable is getting cleared for every query or not.