Maximum Swap Leetcode Javascript Problems Solving