mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2026-02-02 18:39:09 +08:00
更新代码块
This commit is contained in:
@@ -37,7 +37,7 @@
|
||||
|
||||
不难写出如下代码: (**注意代码中空节点不入栈**)
|
||||
|
||||
```C++
|
||||
```CPP
|
||||
class Solution {
|
||||
public:
|
||||
vector<int> preorderTraversal(TreeNode* root) {
|
||||
@@ -84,7 +84,7 @@ public:
|
||||
|
||||
**中序遍历,可以写出如下代码:**
|
||||
|
||||
```C++
|
||||
```CPP
|
||||
class Solution {
|
||||
public:
|
||||
vector<int> inorderTraversal(TreeNode* root) {
|
||||
@@ -116,7 +116,7 @@ public:
|
||||
|
||||
**所以后序遍历只需要前序遍历的代码稍作修改就可以了,代码如下:**
|
||||
|
||||
```C++
|
||||
```CPP
|
||||
class Solution {
|
||||
public:
|
||||
vector<int> postorderTraversal(TreeNode* root) {
|
||||
|
||||
Reference in New Issue
Block a user