CodeMentor.
Ask AIProblemsLearnC++TCSCore CSHRProgress
0Lv 1
ProblemsArrays

Majority Element

Easy
LeetCode
10/14
EasyArraysLeetCode #169

Majority Element

Element appearing more than n/2 times. Boyer-Moore voting is the interview flex.

Examples

Example 1

Input

3
3 2 3

Output

3
Example 2

Input

7
2 2 1 1 1 2 2

Output

2

Stuck? Take a nudge

C++17Autosaves