HTMLify
LeetCode - Majority Element - Python
Views: 246 | Author: abh
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