Minimum Swaps For Bracket Balancing Leetcode Javascript Solution