Sunday, November 1, 2015

Maximum Depth of Binary Tree

Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.
思路:
1. 树为空返回0
2. 递归求解比较左右子树深度, 返回较大的值加1

No comments:

Post a Comment