Majority Element II (Count)
Easy
Arrays
Array
Hash Table
Count how many elements appear more than n/3 times.
Constraints
1 ≤ n ≤ 10^4
Examples
Example 1:
Input: 3 2 3
Output: 1
Example 2:
Input: 1 1 1 3 3 2 2 2
Output: 2
Tests:
Runtime:
Memory:
Test
Input:
Expected:
Got:
Click Run Code to test against sample cases, or Submit to test against all cases.
▲ Console