当前位置:网站首页>NC84 完全二叉树结点数
NC84 完全二叉树结点数
2022-08-09 13:02:00 【syc596】
NC84 完全二叉树结点数
完全二叉树结点数_牛客题霸_牛客网 (nowcoder.com)
222. 完全二叉树的节点个数
222. 完全二叉树的节点个数 - 力扣(LeetCode)
// //递归-遍历思路
// public class Solution {
// int count=0;
// public int nodeNum(TreeNode root) {
// if(root==null){
// return 0;
// }
// count++;
// nodeNum(root.left);
// nodeNum(root.right);
// return count;
// }
// }
//11
//递归-子问题思路
public class Solution {
public int nodeNum(TreeNode root) {
if(root==null){
return 0;
}
return nodeNum(root.left)+nodeNum(root.right)+1;
}
}
边栏推荐
- Record the system calls and C library functions used in this project-2
- 陈强教授《机器学习及R应用》课程 第十五章作业
- 正则表达式-re模块
- GIN a preliminary study, the environment is installed
- R language kaggle game data exploration and visualization
- kustomize entry example and basic syntax instructions
- 剑指 Offer 57 - II. 和为s的连续正数序列(滑动窗口)
- 5G 联通网管设计思路
- 七夕力扣刷不停,343. 整数拆分(剑指 Offer 14- I. 剪绳子、剑指 Offer 14- II. 剪绳子 II)
- read stream 特别注意
猜你喜欢
kustomize entry example and basic syntax instructions
Anta and Huawei Sports Health jointly verify the champion running shoes and lead Chinese sports with innovation
5G China unicom 一般性异常处理
七夕力扣刷不停,343. 整数拆分(剑指 Offer 14- I. 剪绳子、剑指 Offer 14- II. 剪绳子 II)
RTSP协议讲解
GIN Bind模式获取参数和表单验证
jenkins api创建自定义pipeline
GIN file upload and return
行程和用户[阅读理解法]
gin's middleware and routing grouping
随机推荐
某高校的R语言数据分析期末作业
5G Unicom Network Management Design Ideas
43. The sword refers to Offer 1 ~ 1 the number of occurrences of n integers (recursive, mathematics)
glibc 内存管理模型 释放 C库内存缓存
ftplib+ tqdm 上传下载进度条
Unity3d_API_Gyroscope 陀螺仪的接口
Anta and Huawei Sports Health jointly verify the champion running shoes and lead Chinese sports with innovation
FFmpeg多媒体文件处理(ffmpeg操作目录及list的实现)
R语言kaggle 游戏数据探索与可视化
Jenkins API groovy调用实践: Jenkins Core Api & Job DSL创建项目
FPGA-在ISE中错误总结(更新中)
RTSP协议讲解
GIN file upload and return
JS轮播图实现
error Trailing spaces not allowed no-trailing-spaces 9:14 error Unexpected trailing comma
read stream 特别注意
记录本项目中用到的系统调用与C库函数-2
Standing wave ratio calculation method
【FPGA教程案例48】图像案例8——基于FPGA的RGB图像转化为HSV图像的实现,通过MATLAB进行辅助验证
Professor Chen Qiang "application in machine learning and R" course chapter 17