摘要:
```/** * 235. Lowest Common Ancestor of a Binary Search Tree * 1. Time:O(n) Space:O(n) * 2. Time:O(n) Space:O(1) */// 1. Time:O(n) Space:O(n)class Solution { public TreeNode lowestCommonAncestor... 阅读全文
摘要:
``` /** * 109. Convert Sorted List to Binary Search Tree * 1. Time:O(nlogn) Space:O(logn) * 2. Time:O(n) Space:O(logn) */ // 1. Time:O(nlogn) Space:O(logn) class Solution { public TreeNode sortedListT 阅读全文
摘要:
``` /** * 108. Convert Sorted Array to Binary Search Tree * 1. Time:O(n) Space:O(n) * 2. Time:O(n) Space:O(n) */ // 1. Time:O(n) Space:O(n) class Solution { private int[] nums; public TreeNode sortedA 阅读全文
摘要:
``` /** * 98. Validate Binary Search Tree * 1. Time:O(n) Space:O(n) * 2. Time:O(n) Space:O(n) */ // 1. Time:O(n) Space:O(n) class Solution { public boolean isValidBST(TreeNode root) { return helper(ro 阅读全文