Learn
Practice
Newsletter
Resources
Resume
New
F
Toggle theme
0
F
Toggle theme
0
Toggle menu
← Back to All Animations
Lowest Common Ancestor of a Binary Tree
Bookmark
Input
Example 1
Example 2
Example 3
Custom
tree
=
[3, 5, 1, 6, 2, 0, 8, null, null, 7, 4]
,
p
=
5
,
q
=
1
3
5
1
6
2
0
8
7
4
algo
master
.
io
Step:
Start: Find lowest common ancestor of p and q
0 / 10
Input
Example 1
Example 2
Example 3
Custom
tree
=
[3, 5, 1, 6, 2, 0, 8, null, null, 7, 4]
,
p
=
5
,
q
=
1
0 / 10
3
5
1
6
2
0
8
7
4
algo
master
.
io
Step:
Start: Find lowest common ancestor of p and q