i wrote a code that failed all cases after submitting (it passed only testcase no 4),so i rewrote a logic with different approach that passed all cases now after unlocking testcases i found that both code give same output yet one fails for some reason i dont know i have provided one of testcase for sample(that was showing wrong ouput for one code but second code passed)
passing all test cases code:https://ide.codingblocks.com/s/214045
failing code:https://ide.codingblocks.com/s/214051
please help me find issue