716. Majority Element II
0
Medium
Given an integer array of size n, Om needs to find all the elements that appear more than ⌊n/3⌋ times. The elements should be printed in sorted form.
Input Format
The first line of input contains N, the size of the array. The second line contains N elements of the array.
Output Format
Print all the elements that appear more than [n/3] times in the array.
Example
Input
5
1 1 2 3 2
Output
1 2
Constraints
1 <= nums.length <= 5 * 10^4
-10^9 <= nums[i] <= 10^9
Loading...
View Submissions
Console