DIY: Lowest Common Ancestor of a Binary Tree
Understand how to find the lowest common ancestor of two given nodes in a binary tree by implementing a Swift function. This lesson helps you break down the problem and write a solution useful for coding interviews.
We'll cover the following...
We'll cover the following...
Problem statement
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree.
Input
The first ...