Repeating And Missing Element Leetcode Javascript Question