Find the Number of Distinct Colors Among the Balls | Leetcode 3160