<doocs>0229.Majority Element II_1.py
def majorityElement( nums: List[int]) -> List[int]:
    n1 = n2 = 0
    m1, m2 = 0, 1
    for m in nums:
        if m == m1:
            n1 += 1
        elif m == m2:
            n2 += 1
        elif n1 == 0:
            m1, n1 = m, 1
        elif n2 == 0:
            m2, n2 = m, 1
        else:
            n1, n2 = n1 - 1, n2 - 1
    return [m for m in [m1, m2] if nums.count(m) > len(nums) // 3]
def sample_funcname ( var_0 : List [ int ] ) -> List [ int ] :
    var_5 = var_3 = 0
    var_6 , var_8 = 0 , 1
    for var_9 in var_0 :
        if var_9 == var_6 :
            var_5 += 1
        elif var_9 == var_8 :
            var_3 += 1
        elif var_5 == 0 :
            var_6 , var_5 = var_9 , 1
        elif var_3 == 0 :
            var_8 , var_3 = var_9 , 1
        else :
            var_5 , var_3 = var_5 - 1 , var_3 - 1
    return [ var_9 for var_9 in [ var_6 , var_8 ] if var_0.count ( var_9 ) > len ( var_0 ) // 3 ]
