Sir, i wanna iterate map in reverse order. but couldn't do it

please correct my code -> https://ide.codingblocks.com/s/472283

Modified Code


at line no 6
name of map should be m not n

sir, what’s the wrong with my code. please correct -> https://ide.codingblocks.com/s/472293

same error as before
don’t use arr[n]
instead use arr[1000];

i have remove the error
you can check now

and plz give feedback in the previous doubt as well

sir, there is still showing incorrect code.

i have just remove the error

ans may be incorrect
what you are doing here??

first, i reverse the map. it means, it’s key will be in descending. Now, i iterate over the array, if(a[i]!=key) the i swap. otherwise just go on the next elemen.

sir, please correct my code.

map<int, int>::reverse_iterator it; // reverse the ma

this statement will not reverse the map
it just provide you the iterator so that you can iterator in reverse order as well

which question you are solving?

will you want to reverse the map?

No Sir, i want to solve this question using this concept.

i am asking what is the question?

Unlock, link-> https://online.codingblocks.com/app/player/190000/content/180096/5364/code-challenge

Your logic is not correct
a[i] will never be equal to key
because in map you are iterating from back and in array you are iterating from front
so how they can be equal

correct way to doing this

question link -> https://online.codingblocks.com/app/player/190000/content/180096/5364/code-challenge my code-> https://ide.codingblocks.com/s/472411 sir, please help me to figure out my error.

sir, it’s my code-> https://ide.codingblocks.com/s/472411 please help me to find my error.

sir, it’s my code-> https://ide.codingblocks.com/s/472411 what am i doing mistake?

your logic is not correct
this will not work
dry run your code you will understand this logic is not correct

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.