LeetCode知识点总结 – 897

LeetCode 897. Increasing Order Search Tree
考点难度TreeEasy
题目
Given the root of a binary search tree, rearrange the tree in in-order so that the leftmost node in the tree is now the root of the tree, and every node has no left child and only one right child.
思路
先用inorder traversal把tree里的数字从小到大排列,再把新建的nodes连起来。
答案
class Solution {
public TreeNode increasingBST(TreeNode root) {
List vals

LeetCode知识点总结 – 897最先出现在Python成神之路

版权声明:
作者:dingding
链接:https://www.techfm.club/p/11878.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>