LeetCode
Majority Element
Click
here
for an explanation.