Skip to content

Commit 271b617

Browse files
committed
Add 235 note
1 parent 969bae8 commit 271b617

File tree

1 file changed

+15
-0
lines changed
  • solutions/235.Lowest_Common_Ancestor_of_a_Binary_Search_Tree

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
## 235. Lowest Common Ancestor of a Binary Search Tree (Easy)
2+
3+
### **链接**
4+
题目:https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/
5+
代码(github):https://github.com/illuz/leetcode
6+
7+
### **题意**
8+
9+
求一个搜索二叉树的 LCA(最近公共祖先)。
10+
11+
### **分析**
12+
13+
可以利用二叉树的性质做,只要从根节点向下找,如果 `leftval <= sub_root.val <= rightval`,那 sub_root 就是他们的 LCA。
14+
可以用递归做,也可以迭代做。
15+

0 commit comments

Comments
 (0)