Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdfc61e9

Browse files
refactor 236
1 parentbff388e commitdfc61e9

File tree

1 file changed

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

1 file changed

+0
-19
lines changed

‎src/main/java/com/fishercoder/solutions/_236.java

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

33
importcom.fishercoder.common.classes.TreeNode;
44

5-
/**
6-
* 236. Lowest Common Ancestor of a Binary Tree
7-
*
8-
* Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.
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
11-
* that has both v and w as descendants (where we allow a node to be a descendant of itself).”
12-
13-
_______3______
14-
/ \
15-
___5__ ___1__
16-
/ \ / \
17-
6 _2 0 8
18-
/ \
19-
7 4
20-
21-
For example, the lowest common ancestor (LCA) of nodes 5 and 1 is 3.
22-
Another example is LCA of nodes 5 and 4 is 5, since a node can be a descendant of itself according to the LCA definition.*/
23-
245
publicclass_236 {
256
publicstaticclassSolution1 {
267

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp