update 0104.二叉树的最大深度: 调整一段 js 代码格式

This commit is contained in:
Yuhao Ju
2022-11-30 15:36:25 +08:00
committed by GitHub
parent 1e873a1984
commit dc3517c1b0

View File

@ -59,7 +59,7 @@ int getdepth(treenode* node)
if (node == NULL) return 0; if (node == NULL) return 0;
``` ```
3. 确定单层递归的逻辑:先求它的左子树的深度,再求右子树的深度,最后取左右深度最大的数值 再+1 加1是因为算上当前中间节点就是目前节点为根节点的树的深度。 3. 确定单层递归的逻辑:先求它的左子树的深度,再求右子树的深度,最后取左右深度最大的数值 再+1 加1是因为算上当前中间节点就是目前节点为根节点的树的深度。
代码如下: 代码如下: