@@ -0,0 +1,1016 @@
+# Definition for a binary tree node.%0A# class TreeNode(object):%0A#     def __init__(self, x):%0A#         self.val = x%0A#         self.left = None%0A#         self.right = None%0A%0Aclass Solution(object):%0A    def dfs(self, cur):%0A        if cur:%0A            if self.smallest is None:%0A                self.smallest = cur.val%0A            elif self.smallest %3E cur.val:%0A                self.smallest, self.secondSmallest = cur.val, self.smallest%0A            elif self.smallest %3C cur.val:%0A                if self.secondSmallest is None:%0A                    self.secondSmallest = cur.val%0A                elif self.secondSmallest %3E cur.val:%0A                    self.secondSmallest = cur.val%0A            self.dfs(cur.left)%0A            self.dfs(cur.right)%0A%0A%0A    def findSecondMinimumValue(self, root):%0A        %22%22%22%0A        :type root: TreeNode%0A        :rtype: int%0A        %22%22%22%0A        self.smallest = None%0A        self.secondSmallest = None%0A        self.dfs(root)%0A        return -1 if self.secondSmallest is None else self.secondSmallest%0A

Add py solution for 671. Second Minimum Node In a Binary Tree