Meta Interview Question

Given a binary tree, find the longest path length in the tree.

Interview Answers

Anonymous

Jul 30, 2018

It seems that you were asked about not for the longest root to leaf path, but any path. In that case, it would be the max of left_height + right_height + 1 from any root.

Anonymous

Jul 29, 2018

It's similar to find the height of a tree, but now you have to keep reference of the longest path.