114 Flatten Binary Tree to Linked List
114 Flatten Binary Tree to Linked List
这道题就是Preorder的稍微变种, 记住 pre 的节点就好
class Solution: def __init__(self): self.pre = TreeNode("dummy") def flatten(self, root): if root == None: return tmp = root.right self.pre.right = root self.pre.left = None self.pre = root self.flatten(root.left) self.flatten(tmp)