One test case not passing

sir please tell whats wrong in this code… one test case not passing

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

Consider a test case:
5
7 3 4 5 2
correct output : -1 4 5 7 7
your code gives : 4 5 -1

Refer this for the correct approach Can you hint something on how to solve this question

pls tell the error in this code

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.

Hello @Vaibhav277 you have raised the doubt again tell me what is the problem that you are facing?

kindly tell error in this

one test cae not passing

@Vaibhav277 check this code:


Happy Learning!!

ya got it… https://ide.codingblocks.com/s/425433 … this is my code… it is running perfectly… but can it be optimized further??

@Vaibhav277 check this:


this is optimised one:

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.