Problems > Majority Element > Editorial

Majority Element — Solution & Editorial

Back to the Problem

Count with a hash map (or use Boyer–Moore voting) and verify the winner's count exceeds N/2.

Complexity: O(N)