Different answer on same testcase when run on custom input and when run on test


#1

I am getting 290 for [ 84, 2, 37, 3, 67, 82, 19, 97, 91, 63, 27, 6, 13, 90, 63, 89, 100, 60, 47, 96, 54, 26, 64, 50, 71, 16, 6, 40, 84, 93, 67, 85, 16, 22, 60 ] in custom input and 291 during test. Please resolve this.


#2

Custom input calls your function once.
Test and Submit call your function multiple times, without reinitializing any global or static variables. Therefore, one must always manually reinitialize global or static variables at the start of a test run! I suspect your count variable had a count of 1 left over from the previous test.