Search
⌘K

Leetcode 169. Majority Element

Given an array of n integers, return the element that appears more than ⌊n/2⌋ times (the majority element is guaranteed to exist). The goal is to identify this element efficiently, ideally in O(n) time and O(1) space (versus using counting or hashing).

Asked at:

Microsoft

Microsoft


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Late December, 2025

Microsoft

Microsoft

Mid-level

Given an array nums of size n, return the majority element. The majority element is the element that appears more than ⌊n / 2⌋ times. You may assume that the majority element always exists in the array.

Mid May, 2025

Microsoft

Microsoft

Mid-level

Comments

Your account is free and you can post anonymously if you choose.