<doocs>0366.Find Leaves of Binary Tree_1.py
def dfs(root, prev, t):
    if root is None:
        return
    if root.left is None and root.right is None:
        t.append(root.val)
        if prev.left == root:
            prev.left = None
        else:
            prev.right = None
    dfs(root.left, root, t)
    dfs(root.right, root, t)
def sample_funcname ( var_1 , var_2 , var_3 ) :
    if var_1 is None :
        return
    if var_1.left is None and var_1.right is None :
        var_3.append ( var_1.val )
        if var_2.left == var_1 :
            var_2.left = None
        else :
            var_2.right = None
    var_0 ( var_1.left , var_1 , var_3 )
    var_0 ( var_1.right , var_1 , var_3 )
