搜索此博客

2011年2月28日星期一

Given a binary tree, write a function to find the length of the longest path in the tree.

Input: Binary Tree
10
/ \
6 14
/ / \
4 12 16
The depth of the tree is 3.





Recursive Solution:

没有评论:

发表评论