Leetcode/python/169_majority_element.py
2024-04-30 17:11:48 +01:00

4 lines
136 B
Python

class Solution:
def majorityElement(self, nums: List[int]) -> int:
return max(Counter(nums).items(), key=lambda k: k[1])[0]