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


For the test case:

A : 1
B : 100


did u manage to find a solution for this problem?


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.


Thanks dude , it worked


@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.