摘要: ```/** * 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... 阅读全文
posted @ 2020-05-07 12:00 AAAmsl 阅读(80) 评论(0) 推荐(0) 编辑
摘要: ``` /** * 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 阅读全文
posted @ 2020-05-07 11:58 AAAmsl 阅读(54) 评论(0) 推荐(0) 编辑
摘要: ``` /** * 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 阅读全文
posted @ 2020-05-07 11:57 AAAmsl 阅读(86) 评论(0) 推荐(0) 编辑
摘要: ``` /** * 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 阅读全文
posted @ 2020-05-07 11:56 AAAmsl 阅读(64) 评论(0) 推荐(0) 编辑