Amazon interview question

Question based on LCA of a binary tree