Can u please tell me why my code is not working


my code is working fine with the given sample test case then why is it not able to pass the other test cases