leetcode [#104] | GCidea's blog
目录

题目
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 | /** |
注意事项
思路是递归,根据二叉树的结构,某个子节点是其子树的根节点,则不断反复进行递归直到找到叶子节点,返回为零,其余不断加1,累计总长度(左右子节点均相同处理)。