Unlock hint in hashing

https://ide.codingblocks.com/s/372889 multiple time i post this question you told me to change 29 and 30 line ,moreover you send me one image where you told me to change 30 line as m[arr[m[num]]]=m[num] but its giving wrong output pls change 29 and 30 line don’t change the entire code …moreover my code is giving correct output but its not passing testcases

mistakes

  1. at line no 26
    if(m[num]!=bestposition)
    you should have to compare arr[num]
    so correct one is
    if (arr[num] != bestposition)

  2. first you have to find the index of element which has to be placed at position num and then swap it
    also update the hashmap

int idx=m.find(bestposition)->second;

                m[arr[num]]=idx;

                m[bestposition]=num;

                swap(arr[num],arr[idx]);

Modified Code