mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-08 00:43:04 +08:00
Update '''0222.完全二叉树的节点个数.md''' Fix Typo
修复部分代码块无高亮
This commit is contained in:
@ -54,7 +54,7 @@
|
|||||||
1. 确定递归函数的参数和返回值:参数就是传入树的根节点,返回就返回以该节点为根节点二叉树的节点数量,所以返回值为int类型。
|
1. 确定递归函数的参数和返回值:参数就是传入树的根节点,返回就返回以该节点为根节点二叉树的节点数量,所以返回值为int类型。
|
||||||
|
|
||||||
代码如下:
|
代码如下:
|
||||||
```
|
```CPP
|
||||||
int getNodesNum(TreeNode* cur) {
|
int getNodesNum(TreeNode* cur) {
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ int getNodesNum(TreeNode* cur) {
|
|||||||
|
|
||||||
代码如下:
|
代码如下:
|
||||||
|
|
||||||
```
|
```CPP
|
||||||
if (cur == NULL) return 0;
|
if (cur == NULL) return 0;
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ if (cur == NULL) return 0;
|
|||||||
|
|
||||||
代码如下:
|
代码如下:
|
||||||
|
|
||||||
```
|
```CPP
|
||||||
int leftNum = getNodesNum(cur->left); // 左
|
int leftNum = getNodesNum(cur->left); // 左
|
||||||
int rightNum = getNodesNum(cur->right); // 右
|
int rightNum = getNodesNum(cur->right); // 右
|
||||||
int treeNum = leftNum + rightNum + 1; // 中
|
int treeNum = leftNum + rightNum + 1; // 中
|
||||||
|
Reference in New Issue
Block a user