Thursday, July 4, 2019

Two node's distance in binary tree

July 4, 2019

I like to share my practice on this algorithm related to lowest common ancestor. Here is the post I updated on Leetcode 236: Lowest common ancestor in binary tree.

Two node's distance in binary tree, the post is here.
My solution is written here. The idea is to find lowest common ancestor, and then calculate the distance between two nodes indirectly both to lowest common ancestor.
C# Lowest common ancestor -> two node's distance practice (upward)
C# Lowest common ancestor -> two node's distance practice

No comments:

Post a Comment