A clear python learn from others


  • 1
    J
    class Solution(object):
    pre=None
    def flatten(self, root):
        """
        :type root: TreeNode
        :rtype: void Do not return anything, modify root in-place instead.
        """
        if not root:
            return
        self.flatten(root.right)
        self.flatten(root.left)
        root.right=self.pre
        root.left=None
        self.pre=root

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.