<qiyuangong>671_Second_Minimum_Node_In_a_Binary_Tree_1.py
def findSecondMinimumValue( root):
    if not root:
        return -1
    ans = float('inf')
    min_val = root.val
    stack = [root]
    while stack:
        curr = stack.pop()
        if not curr:
            continue
        if min_val < curr.val < ans:
            ans = curr.val
        elif curr.val == min_val:
            stack.append(curr.left)
            stack.append(curr.right)
    return ans if ans < float('inf') else -1
def sample_funcname ( var_0 ) :
    if not var_0 :
        return - 1
    var_4 = float ( 'inf' )
    var_6 = var_0.val
    var_7 = [ var_0 ]
    while var_7 :
        var_9 = var_7.pop ( )
        if not var_9 :
            continue
        if var_6 < var_9.val < var_4 :
            var_4 = var_9.val
        elif var_9.val == var_6 :
            var_7.append ( var_9.left )
            var_7.append ( var_9.right )
    return var_4 if var_4 < float ( 'inf' ) else - 1
