I am getting the answer but one of my test case is not working
@Adhyayan please share ur code using ide.codingblocks.com
I have saved the code ,please check.
@Adhyayan please share the saved code link
@Adhyayan try and dry run 5 30 40 35 45 42 correct answer 1 2 1 4 1 END your answer 1 2 1 2 1 END