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
▲ Console
📱

Install Talent Enrich

Get instant access to jobs and career tools on your device.