Inverse Array Problem: Sample Output Issue

Sir/Ma’am
In this problem the sample output should have been
3 1 4 2 0; But it is given to 0 3 1 4 2.
Can you please explain why?

hi @siddhjain12sj34_f9d611034fa2bf83,
Logic: Inverse is Simply swapping the value of the array with the value at that index.

Algo

  1. Create a new Array say narr and original array is arr.
  2. now at the arr[i]th index of narr save the ith value.(previously i is the index and arr[i] is the value bt now arr[i] is the index and i is the value.)
  3. print new array.

here’s the updated code https://ide.codingblocks.com/s/659002

Sample Input
5
0
2
4
1
3
Sample Output
0 3 1 4 2

here it means 0 will be in 0 index
1 in 2
2 in 4
3 in 1
4 in 3