>_
majority_element.scala
Scala 3.6
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.