Lowest Common Ancestor of a BST
Medium
Binary Search Tree
Given a BST (level-order form) and two node values p and q present 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.