Given a binary tree and two nodes p and q that both exist in the tree, find their lowest common ancestor (LCA): the deepest node that has both p and q as descendants (a node may be a descendant of…
You've read your 3 free write-ups
Sign up free to keep reading. Your account opens the first 10 questions of every company.