Majority Element
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.
Majority Element

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.

Example 1:
Input: [2,2,1,1,1,2,2]
Output: 2
Input
arr =[2,2,1,1,1,2,2]

Boyer-Moore Voting: Find the majority element

Candidate

-

Count

0

Array
2
2
1
1
1
2
2
Current
Candidate Value
Variables
No variables to display
DepthFunction Call
Stack empty
0/8