Skip to content

Commit bff388e

Browse files
refactor 235
1 parent 6fdebfe commit bff388e

File tree

1 file changed

+0
-20
lines changed
  • src/main/java/com/fishercoder/solutions

1 file changed

+0
-20
lines changed

src/main/java/com/fishercoder/solutions/_235.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,6 @@
22

33
import com.fishercoder.common.classes.TreeNode;
44

5-
/**
6-
* 235. Lowest Common Ancestor of a Binary Search Tree
7-
*
8-
* Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.
9-
* According to the definition of LCA on Wikipedia:
10-
* “The lowest common ancestor is defined between two nodes v and w as the lowest node in T that has both v and w as descendants
11-
* (where we allow a node to be a descendant of itself).”
12-
13-
_______6______
14-
/ \
15-
___2__ ___8__
16-
/ \ / \
17-
0 4 7 9
18-
/ \
19-
3 5
20-
21-
For example, the lowest common ancestor (LCA) of nodes 2 and 8 is 6.
22-
Another example is LCA of nodes 2 and 4 is 2, since a node can be a descendant of itself according to the LCA definition.
23-
24-
*/
255
public class _235 {
266

277
public static class Solution1 {

0 commit comments

Comments
 (0)