class Solution:

    def majorityElement(self, nums: List[int]) ->int:
        count, cur = 0, 0
        for num in nums:
            if not count:
                cur = num
            count += 1 if num == cur else -1
        return cur

897dae535891380c42f0abbe09e482e66de618d7
<mask token>

class Solution:
    <mask token>

class Solution:

    def majorityElement(self, nums: List[int]) ->int:
        count, cur = 0, 0
        for num in nums:
            if not count:
                cur = num
            count += 1 if num == cur else -1
        return cur
