How Many Share the Top Count
Count how many times each distinct value appears in nums. The top count is the largest of those counts.
Return how many distinct values appear exactly top-count times, that is, how many values tie for the most frequent. The empty list gives 0.
Example 1
nums [1,2,2,3,3,3]
returns 1
3 appears three times, more than any other value, so only one value has the top count.
Example 2
nums [4,4,5,5,6]
returns 2
4 and 5 both appear twice, 6 once: two values share the top count of 2.
Constraints
0 <= len(nums) <= 100-1000 <= nums[i] <= 1000
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.