<doocs>0946.Validate Stack Sequences_1.py
def validateStackSequences( pushed: List[int], popped: List[int]) -> bool:
    j, stk = 0, []
    for v in pushed:
        stk.append(v)
        while stk and stk[-1] == popped[j]:
            stk.pop()
            j += 1
    return j == len(pushed)
def sample_funcname ( var_0 : List [ int ] , var_3 : List [ int ] ) -> bool :
    var_6 , var_7 = 0 , [ ]
    for var_8 in var_0 :
        var_7.append ( var_8 )
        while var_7 and var_7 [ - 1 ] == var_3 [ var_6 ] :
            var_7.pop ( )
            var_6 += 1
    return var_6 == len ( var_0 )
