What is wrong here?

test case 1 is not passing. What’s wrong with my approach and how can I rectify it?

Save your code on ide.codingblocks.com and share its link.

Your code is failing for this test case:
5
39 45 40 42 43

Expected o/p:
1 2 1 2 3 END

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.