According to my logic, the code works fine.
I am unable to think about any particular test case where it can fail.
Please explain me the error in logic and if possible please give an example test case where it fails
CODE FILE: https://ide.codingblocks.com/s/218631