Easy · Arrays
Find majority element
Given an integer array nums of length n in which one value occurs more than n/2 times, return that value.
Examples
Example 1
[2,2,1,1,1,2,2]Output: majority = 2
Example 2
[3,3,4,2,3,3,3]Output: majority = 3
Rebuild it in the studio
Open every published interview problem, solution, scene, and memory room free, with no account.