Flatten Binary Tree to Linked List Solutions in PythonNumber 114Difficulty MediumAcceptance 49.4%Link LeetCodeOther languages C++, GoSolutionsPython solution by haoel/leetcodeclass Solution(object): def __init__(self): self.prev = None def flatten(self, root): if not root: return None self.flatten(root.right) self.flatten(root.left) root.right = self.prev root.left = None self.prev = rootclass Solution(object): def __init__(self): self.prev = None def flatten(self, root): if not root: return None self.flatten(root.right) self.flatten(root.left) root.right = self.prev root.left = None self.prev = root