Medium

Quiz

#229 Majority Element II

APPROACH

Given an integer array of size n, find every element that appears strictly more than ⌊ n/3 ⌋ times and return them.

Example 1:

Input: nums = [3,2,3]
Output: [3]

Example 2:

Input: nums = [1]
Output: [1]

Example 3:

Input: nums = [1,2]
Output: [1,2]
1 of 4
1:00

What is the optimal approach for this problem?