""" https://leetcode.com/problems/majority-element/
suboptimal solution: find major element by frequency table
"""
class Solution:
    def majorityElement(self, nums: List[int]) -> int:
        return [k for k, v in collections.Counter(nums).items() if v>len(nums)//2][0]
17aa5fb0f4819db497e57d1210ffec853c6c780a
<mask token>

<mask token>


class Solution:
    <mask token>

<mask token>


class Solution:

    def majorityElement(self, nums: List[int]) ->int:
        return [k for k, v in collections.Counter(nums).items() if v > len(
            nums) // 2][0]

""" https://leetcode.com/problems/majority-element/
suboptimal solution: find major element by frequency table
"""
class Solution:
    def majorityElement(self, nums: List[int]) -> int:
        return [k for k, v in collections.Counter(nums).items() if v>len(nums)//2][0]