>_
majority_element.rb
Ruby 4.0
Not run yet

+ 7 hidden

Input
nums = [4, 7, 4, 4, 2]
Expected
4

4 sits at three of the five positions, and three is more than half of five.