Minimum Number Of Swaps Leetcode Javascript