Majority Element at Microsoft

Easy66.1% acceptance

This problem has 75.0% frequency at Microsoft.

Problem Description

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.

Read full problem and hints

Topics

Also asked at 21 companies


More Microsoft Questions

View all Microsoft questions