Lowest Common Ancestor of a Binary Tree
Medium
Binary Trees
Given a binary tree (level-order form, unique values) and two values p and q that exist in the tree, print the value of their lowest common ancestor.
Constraints
2 <= number of nodes <= 10^5 All values are unique
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.