Test cases givng wrong answer

the test cases seem to be giving the wrong answer and I cant figure out why. Please point out the problem in my code. I have used logic similar to previous one