Skip to content

Commit

Permalink
Merge pull request #2533 from VoxDai/patch-1
Browse files Browse the repository at this point in the history
Update 0111.二叉树的最小深度.md / Fix typo
  • Loading branch information
youngyangyang04 committed May 14, 2024
2 parents ba12ff6 + 9fdaeb5 commit 56a7c68
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions problems/0111.二叉树的最小深度.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

代码如下:

```
```CPP
int getDepth(TreeNode* node)
```

Expand All @@ -74,14 +74,14 @@ int getDepth(TreeNode* node)

代码如下:

```
```CPP
if (node == NULLreturn 0;
```

3. 确定单层递归的逻辑

这块和求最大深度可就不一样了,一些同学可能会写如下代码:
```
```CPP
int leftDepth = getDepth(node->left);
int rightDepth = getDepth(node->right);
int result = 1 + min(leftDepth, rightDepth);
Expand Down

0 comments on commit 56a7c68

Please sign in to comment.