<doocs>0498.Diagonal Traverse_1.py
def findDiagonalOrder( mat: List[List[int]]) -> List[int]:
    m, n = len(mat), len(mat[0])
    ans = []
    for k in range(m + n - 1):
        t = []
        i = 0 if k < n else k - n + 1
        j = k if k < n else n - 1
        while i < m and j >= 0:
            t.append(mat[i][j])
            i += 1
            j -= 1
        if k % 2 == 0:
            t = t[::-1]
        ans.extend(t)
    return ans
def sample_funcname ( var_0 : List [ List [ int ] ] ) -> List [ int ] :
    var_4 , var_6 = len ( var_0 ) , len ( var_0 [ 0 ] )
    var_7 = [ ]
    for var_10 in range ( var_4 + var_6 - 1 ) :
        var_11 = [ ]
        var_12 = 0 if var_10 < var_6 else var_10 - var_6 + 1
        var_13 = var_10 if var_10 < var_6 else var_6 - 1
        while var_12 < var_4 and var_13 >= 0 :
            var_11.append ( var_0 [ var_12 ] [ var_13 ] )
            var_12 += 1
            var_13 -= 1
        if var_10 % 2 == 0 :
            var_11 = var_11 [ : : - 1 ]
        var_7.extend ( var_11 )
    return var_7
