Repeated Number Leetcode Javascript