会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
π+1
博客园
首页
新随笔
联系
管理
订阅
2019年5月21日
输入一棵二叉树,求该树的深度。从根结点到叶结点依次经过的结点(含根、叶结点)形成树的一条路径,最长路径的长度为树的深度。
摘要: //递归方式 public int TreeDepth(TreeNode root) { if(root == null){ return 0; } TreeNode node = root; int left = TreeDepth(node.left); int right = TreeDepth...
阅读全文
posted @ 2019-05-21 09:32 紫色的雪
阅读(914)
评论(0)
推荐(0)
公告