Please help me with the code

What is wrong in the implementation. I am always getting a wrong answer