Code not working for all test cases


please help me to identify the error in this code

@rajanarora1999
refer to this