Majority Element II

Given an integer array of size n, find all elements that appear more than floor(n/3) times.

Constraints

  • 1 <= nums.length <= 5 * 10^4
  • -10^9 <= nums[i] <= 10^9
Saving… · 2 lines
class Solution:
def majorityElementII(self, nums) -> List[int]:
Console

Click Run to execute sample tests.