今天这道题比较简单,就不罗说了,是一个二叉树深度的判断,直接放代码记录一下,这里用了递归,应该还有更好的方法,有空了再想一想。
题目
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.
代码
|
|
今天这道题比较简单,就不罗说了,是一个二叉树深度的判断,直接放代码记录一下,这里用了递归,应该还有更好的方法,有空了再想一想。
题目
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.
代码
|
|
近期评论