class Solution:
def increasingBST(self, root: TreeNode) -> TreeNode:
def recursion(root):
if not root:
return
recursion(root.left)
# self.thisNode = TreeNode(root.val)
root.left = None
if not self.lastNode:
self.lastNode = root
self.head = root
else:
self.lastNode.right = root
self.lastNode = root
recursion(root.right)
self.lastNode = None
self.head = None
recursion(root)
return self.head
树 简单 每日一题 做过的
https://leetcode-cn.com/problems/increasing-order-search-tree/