From 1e873a198404af7550071f134c50bc205cd5101e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E5=91=98Carl?= Date: Wed, 30 Nov 2022 11:58:41 +0800 Subject: [PATCH] =?UTF-8?q?Update=200226.=E7=BF=BB=E8=BD=AC=E4=BA=8C?= =?UTF-8?q?=E5=8F=89=E6=A0=91.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/0226.翻转二叉树.md | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/problems/0226.翻转二叉树.md b/problems/0226.翻转二叉树.md index 011c695d..ad2a7de2 100644 --- a/problems/0226.翻转二叉树.md +++ b/problems/0226.翻转二叉树.md @@ -257,7 +257,7 @@ public: ## 其他语言版本 -Java +### Java ```Java //DFS递归 class Solution { @@ -308,7 +308,7 @@ class Solution { } ``` -Python +### Python 递归法:前序遍历: ```python @@ -360,7 +360,7 @@ class Solution: return root ``` -Go +### Go 递归版本的前序遍历 ```Go @@ -469,7 +469,7 @@ func invertTree(root *TreeNode) *TreeNode { } ``` -JavaScript +### JavaScript 使用递归版本的前序遍历 ```javascript @@ -550,7 +550,7 @@ var invertTree = function(root) { }; ``` -TypeScript: +### TypeScript: 递归法: @@ -677,7 +677,7 @@ function invertTree(root: TreeNode | null): TreeNode | null { }; ``` -C +### C 递归法 ```c @@ -724,7 +724,7 @@ struct TreeNode* invertTree(struct TreeNode* root){ } ``` -Swift: +### Swift: ```swift // 前序遍历-递归 func invertTree(_ root: TreeNode?) -> TreeNode? { @@ -762,7 +762,6 @@ func invertTree1(_ root: TreeNode?) -> TreeNode? { } ``` -Swift 深度优先递归。 @@ -856,7 +855,7 @@ object Solution { } ``` -rust +### rust ```rust impl Solution {