小记录n

66 阅读1分钟

669. Trim a Binary Search Tree

简单题,根据 low, high 确定是否需要 pruning

108. Convert Sorted Array to Binary Search Tree

简单题,核心在于找 root

538. Convert BST to Greater Tree

有一点点难度,核心在于通过 postorder traversal 去找到每个 right node 和累计,这样对于下一个遍历到下一个节点的时候+=累计即可