LeetCode-Maximum Depth of Binary Tree

来源:互联网 发布:deandre ayton体测数据 编辑:程序博客网 时间:2024/06/10 05:24

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
原创粉丝点击