Check whether a list has a majority element
Your task
Given a non-empty list nums, return True if any single value occupies strictly more than half of the positions (a strict majority element), otherwise False. For example [3, 3, 4, 2, 3] has 3 appearing 3 of 5 times (>2.5), so return True. The list has at least one element.
Examples
has_majority(nums: list[int]) -> boolExample 1
Input
has_majority([3, 3, 4, 2, 3])Output
True