diff --git a/python/169_majority_element.py b/python/169_majority_element.py new file mode 100644 index 0000000..4637adf --- /dev/null +++ b/python/169_majority_element.py @@ -0,0 +1,3 @@ +class Solution: + def majorityElement(self, nums: List[int]) -> int: + return max(Counter(nums).items(), key=lambda k: k[1])[0]