更新代码块

This commit is contained in:
youngyangyang04
2021-08-10 22:20:48 +08:00
parent c7c34dd824
commit 8a2d42013c
192 changed files with 552 additions and 552 deletions

View File

@@ -87,7 +87,7 @@ return result;
代码如下:
```C++
```CPP
int leftDepth = getDepth(node->left); // 左
int rightDepth = getDepth(node->right); // 右
// 中
@@ -106,7 +106,7 @@ return result;
遍历的顺序为后序(左右中),可以看出:**求二叉树的最小深度和求二叉树的最大深度的差别主要在于处理左右孩子不为空的逻辑。**
整体递归代码如下:
```C++
```CPP
class Solution {
public:
int getDepth(TreeNode* node) {
@@ -134,7 +134,7 @@ public:
精简之后代码如下:
```C++
```CPP
class Solution {
public:
int minDepth(TreeNode* root) {
@@ -162,7 +162,7 @@ public:
代码如下:(详细注释)
```C++
```CPP
class Solution {
public: