← All problems
Lowest Common Ancestor (Binary Tree)
Find the lowest common ancestor of two nodes in a binary tree.
Complexity
Time O(n), Space O(h)
Common pitfalls
- Assuming BST properties in a general tree
- Not handling p == q
Your solution
Log in to save your code and track progress.