码迷,mamicode.com
首页 > 其他好文 > 详细

Leetcode(104)之二叉树的最大深度

时间:2020-01-04 14:34:32      阅读:56      评论:0      收藏:0      [点我收藏+]

标签:mat   ams   node   class   clu   http   title   scn   ref   

题目描述:

技术图片

解题思路:

技术图片

代码:

public int MaxDepth(TreeNode root)
{
    if (root == null) return 0;
    return Mathf.Max(MaxDepth(root.left) + 1, MaxDepth(root.right) + 1);
}
来源:http://www.1994july.club/

Leetcode(104)之二叉树的最大深度

标签:mat   ams   node   class   clu   http   title   scn   ref   

原文地址:https://www.cnblogs.com/1994july/p/12148847.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!