One test case is not passing


this is the link for my code

@LP19DPPM0041 Your code gives wrong answer for this test case
5
2 1 3 2 3
You are not considering the case when elements can be equal.
Correct output in this case should be 1 1 3 1 5
I would recommend you to solve this question using stack.

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.