on running the cases as custom test input, it gives the right answer but on Submitting solution the same test input gives wrong answer.
Hii facing the same problem… Is your problem solved??
Did you forget to clear the global variables?
Cause the tests run multiple test cases one after another and we need to reinitialize all the global variables before each test case is tested.