<doocs>0393.UTF-8 Validation_1.py
def validUtf8( data: List[int]) -> bool:
    n = 0
    for v in data:
        if n > 0:
            if v >> 6 != 0b10:
                return False
            n -= 1
        elif v >> 7 == 0:
            n = 0
        elif v >> 5 == 0b110:
            n = 1
        elif v >> 4 == 0b1110:
            n = 2
        elif v >> 3 == 0b11110:
            n = 3
        else:
            return False
    return n == 0
def sample_funcname ( var_0 : List [ int ] ) -> bool :
    var_5 = 0
    for var_6 in var_0 :
        if var_5 > 0 :
            if var_6 >> 6 != 0b10 :
                return False
            var_5 -= 1
        elif var_6 >> 7 == 0 :
            var_5 = 0
        elif var_6 >> 5 == 0b110 :
            var_5 = 1
        elif var_6 >> 4 == 0b1110 :
            var_5 = 2
        elif var_6 >> 3 == 0b11110 :
            var_5 = 3
        else :
            return False
    return var_5 == 0
