Skip to content

Commit dfc61e9

Browse files
refactor 236
1 parent bff388e commit dfc61e9

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
import com.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
public class _236 {
256
public static class Solution1 {
267

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy