I am getting the correct answer for sample test case but wrong answer when I am submitting the code

I have made a code for the problem and I am getting the correct answer for the sample test case but when I am submitting the solution I am getting a wrong answer.Please tell where is the mistake in my code.The code is :https://ide.codingblocks.com/s/603631

image
in cmp function just make this change in the return statement… ur code will work fine and pass all test cases…

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.