Back to QuestionsPractice with This Question
Boyer-Moore Majority Vote Algorithm
59.2K views•Asked at Google•
Easy
Question Explain
Given an array `nums` of size $n$, return the majority element (the element that appears more than $\lfloor n/2 \rfloor$ times). The algorithm should run in $O(n)$ time and $O(1)$ space.
Start Trying This Question Simulation
Practice answering orally or with text to get instant AI feedback.