Update 0111.二叉树的最小深度.md / Fix typo

部分Markdown代码块没有标注语言导致代码没有高亮
This commit is contained in:
Vox Dai
2024-04-21 09:16:13 +08:00
committed by GitHub
parent 49acc74804
commit 9fdaeb5b90

View File

@ -64,7 +64,7 @@
代码如下:
```
```CPP
int getDepth(TreeNode* node)
```
@ -74,14 +74,14 @@ int getDepth(TreeNode* node)
代码如下:
```
```CPP
if (node == NULL) return 0;
```
3. 确定单层递归的逻辑
这块和求最大深度可就不一样了,一些同学可能会写如下代码:
```
```CPP
int leftDepth = getDepth(node->left);
int rightDepth = getDepth(node->right);
int result = 1 + min(leftDepth, rightDepth);