Count Distinct Element Leetcode Problem