
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Think about the possible number of elements that can appear more than ⌊ n/3 ⌋ times in the array.
It can be at most two. Why?
Consider using Boyer-Moore Voting Algorithm, which is efficient for finding elements that appear more than a certain threshold.