Majority Element II
Return every value that appears more than len(nums) // 3 times in nums, sorted in increasing order. The answer may be an empty list.
Example 1
nums [3,2,3]
returns [3]
len // 3 = 1; 3 appears twice, 2 once.
Example 2
nums [1,2,3,4]
returns []
Each appears once, which is not more than 1.
Constraints
1 <= len(nums) <= 40-20 <= nums[i] <= 20
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.