CodeMosa
Master LeetCode Patterns
All Patterns
Collections
Sign In
Back
Lowest Common Ancestor
Question 1 of 12
8% Complete
Medium
In a general binary tree, how to find LCA of two nodes?
A
Recurse from root: return node when matches or found in both subtrees
B
Use inorder traversal and pick middle
C
BFS and choose deepest common ancestor arbitrarily
D
Binary search on depths