Maximum Swap Leetcode Javascript Solution