Easy · Arrays & hashing

Majority Element

You are given a list of whole numbers in which one value appears more than half the time. Return that value.

  • There is always such a value.
  • The list has at least one number.
  • Try it in one pass with no extra space.
nums = [2, 2, 1, 1, 1, 2, 2]

→ 2
Record your take

No one has solved it yet.