Amazon interview question

Common Lowest Ancestor