Count Distinct Element Leetcode Javascript 30