diff --git a/problems/0222.完全二叉树的节点个数.md b/problems/0222.完全二叉树的节点个数.md index d93d2a33..69403607 100644 --- a/problems/0222.完全二叉树的节点个数.md +++ b/problems/0222.完全二叉树的节点个数.md @@ -54,7 +54,7 @@ 1. 确定递归函数的参数和返回值:参数就是传入树的根节点,返回就返回以该节点为根节点二叉树的节点数量,所以返回值为int类型。 代码如下: -``` +```CPP int getNodesNum(TreeNode* cur) { ``` @@ -62,7 +62,7 @@ int getNodesNum(TreeNode* cur) { 代码如下: -``` +```CPP if (cur == NULL) return 0; ``` @@ -70,7 +70,7 @@ if (cur == NULL) return 0; 代码如下: -``` +```CPP int leftNum = getNodesNum(cur->left); // 左 int rightNum = getNodesNum(cur->right); // 右 int treeNum = leftNum + rightNum + 1; // 中