Wrong result when submitting, right when testing with a custom input


#1

For the test case:

A : 1
B : 100


#2

did u manage to find a solution for this problem?


#3

initialize global variables inside the solution function , this problem is occurring because internally for every test case solution function is called again and again, so the value of global variable computed in the previous test case is affecting the result of the present test case.


#4

Thanks dude , it worked


#5

@rahul-ghosh_666 thanks man it worked , I was actually facing the same issue in many problems and it got cleared now. I am much relieved.