#C5652. Majority Element Finder
Majority Element Finder
Majority Element Finder
Given an array of integers, your task is to find all the elements that appear more than \(\frac{n}{3}\) times, where \(n\) is the number of elements in the array.
If no element satisfies this condition, print an empty line.
Note: The order of the output elements should be the same as the order in which they are determined by the algorithm.
inputFormat
The input is read from standard input (stdin). The first line contains a single integer n, representing the number of elements in the array. The second line contains n space-separated integers.
outputFormat
Output the majority elements which appear more than (\frac{n}{3}) times in the array, separated by a single space. If no such element exists, print an empty line.## sample
3
3 2 3
3
</p>