1 test case not passing

Please see to my logic and code
it is working correct for one test case and sample input

@Ramitgoel The logic you used is no doubt correct, but there were a few bugs in the code part. I have written a function for you, that will work with your code after a little modification. Add that function to you code, and it will run.
Hope this helps.

Where is the function ?
i can’t see it ??

Sorry the link got expired somehow, here is the new link