Https://ide.codingblocks.com/s/163992

one test case is getting failed pls help

Hello @Aug19LPPP0134,

You have missed a very important case.
Look at the image below and observe S5 and S6.
image

Example:
5
30
40
35
45
42
Expected Output:
1 2 1 4 1 END
Your Output:
1 2 1 2 1 END

Hope, this would help.
Give a like if you are satisfied.