Test case 0 is not passing. Check out.
1 count - Test case 0 not passing
Hey @anishanand3733 your code is tough for dry run, I would suggest you to take a reference from my this code as I have also added comments for better understanding https://ide.codingblocks.com/s/336713
Hope this will help you in figuring out your mistake. Happy to help 