1function minimumSwaps(arr) {
2 let swap = 0
3 for(let i = 0;i<arr.length;i++) {
4 while(arr[i] !== i+1) {
5 let temp = arr[i]
6 arr[i] = arr[temp - 1]
7 arr[temp - 1] = temp
8 swap++;
9 }
10 }
11 return swap
12
13}
14