Solve 169. Majority Element

This commit is contained in:
Kiril Kovachev 2024-04-30 17:11:48 +01:00
parent 120ab5f7a0
commit eaa8414c67

View File

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