HTMLify
LeetCode - Majority Element - Python
Views: 348 | Author: abh
1 2 3 4 5 6 | class Solution: def majorityElement(self, nums: List[int]) -> int: f = int(len(nums)/2) for n in set(nums): if nums.count(n) > f: return n |