Approach hintTry it first, then revealHide
At most two values can appear more than n / 3 times. Extend Boyer-Moore voting to two candidates with two counters, then make a second pass to confirm each candidate's real count.
At most two values can appear more than n / 3 times. Extend Boyer-Moore voting to two candidates with two counters, then make a second pass to confirm each candidate's real count.