Need more deep understanding on the problem

I submitted one solution but three test cases are not passing. I am not able to understand where I am going wrong.Kindly help