229. Majority Element II

Practice Majority Element II for free on NudgeCode: Medium, Array & Hash Table pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

Return every value that appears more than n / 3 times in nums (rounded down), where n is the length of the array. The values can be in any order. Try for O(n) time and O(1) extra space.

Example

nums = [3,2,3]  ->  [3]

Constraints