Why is my code giving the wrong output?

2 Changes

  1. swap after updating the map
  2. print elements with space between them

Modified Code

It still fails during submission, what is going wrong?

any answer? i rechecked but still cannot find out the error

code is correct only one another silly mistake

you have done this incorrectly
int*arr=new int(n);
correct way to declare dynamic array (use square brackets)
int*arr=new int[n];

its still not working, look into it again and tell me why

any reply about my query?

all testcase will passed


check once again

Modified 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.