Skip to content

Commit 4ed570a

Browse files
author
Partho Biswas
committed
no message
1 parent 7f25acf commit 4ed570a

File tree

2 files changed

+50
-12
lines changed

2 files changed

+50
-12
lines changed

README.md

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,17 @@ Check this **[Golden](https://tinyurl.com/uboo399)** posts first.
10831083
</details>
10841084

10851085

1086-
### 3. Python
1086+
### 3. Swift
1087+
<details><summary></summary>
1088+
<p>
1089+
1090+
01. []()
1091+
1092+
</p>
1093+
</details>
1094+
1095+
1096+
### 4. Python
10871097
<details><summary></summary>
10881098
<p>
10891099

@@ -1111,7 +1121,7 @@ Learn the following modules by heart. Just knowing all of the following items wi
11111121
</details>
11121122

11131123

1114-
### 4. Channels
1124+
### 5. Channels
11151125
<details><summary></summary>
11161126
<p>
11171127

@@ -1124,7 +1134,7 @@ Learn the following modules by heart. Just knowing all of the following items wi
11241134
</details>
11251135

11261136

1127-
### 5. Tree (Binary Tree, BST, AVL, Red-Black, B-Tree, B+ Tree, Segment Tree, Interval Tree, Range Tree, BIT, N-aray Tree, Trie etc)
1137+
### 6. Tree (Binary Tree, BST, AVL, Red-Black, B-Tree, B+ Tree, Segment Tree, Interval Tree, Range Tree, BIT, N-aray Tree, Trie etc)
11281138
<details><summary></summary>
11291139
<p>
11301140

@@ -1176,7 +1186,7 @@ Learn the following modules by heart. Just knowing all of the following items wi
11761186
</details>
11771187

11781188

1179-
### 6. Graph(Dijkstra, Union Find, Kruskal, Prim's, Minimum Spanning Tree, Topological Ordering...etc)
1189+
### 7. Graph(Dijkstra, Union Find, Kruskal, Prim's, Minimum Spanning Tree, Topological Ordering...etc)
11801190
<details><summary></summary>
11811191
<p>
11821192

@@ -1195,7 +1205,7 @@ Learn the following modules by heart. Just knowing all of the following items wi
11951205
</details>
11961206

11971207

1198-
### 7. Bit Manipulation
1208+
### 8. Bit Manipulation
11991209
<details><summary></summary>
12001210
<p>
12011211

@@ -1226,7 +1236,7 @@ Learn the following modules by heart. Just knowing all of the following items wi
12261236
</details>
12271237

12281238

1229-
### 8. Dynamic Programming
1239+
### 9. Dynamic Programming
12301240
<details><summary></summary>
12311241
<p>
12321242

@@ -1246,7 +1256,7 @@ Learn the following modules by heart. Just knowing all of the following items wi
12461256
</details>
12471257

12481258

1249-
### 9. Greedy
1259+
### 10. Greedy
12501260
<details><summary></summary>
12511261
<p>
12521262

@@ -1261,7 +1271,7 @@ Learn the following modules by heart. Just knowing all of the following items wi
12611271
</details>
12621272

12631273

1264-
### 10. DP VS Greedy
1274+
### 11. DP VS Greedy
12651275
<details><summary></summary>
12661276
<p>
12671277

@@ -1273,7 +1283,7 @@ Learn the following modules by heart. Just knowing all of the following items wi
12731283
</details>
12741284

12751285

1276-
### 11. Backtracking
1286+
### 12. Backtracking
12771287
<details><summary></summary>
12781288
<p>
12791289

@@ -1290,7 +1300,7 @@ Learn the following modules by heart. Just knowing all of the following items wi
12901300
</details>
12911301

12921302

1293-
### 12. Recursion
1303+
### 13. Recursion
12941304
<details><summary></summary>
12951305
<p>
12961306

@@ -1307,7 +1317,7 @@ Learn the following modules by heart. Just knowing all of the following items wi
13071317
</details>
13081318

13091319

1310-
### 13. Game Theory
1320+
### 14. Game Theory
13111321
<details><summary></summary>
13121322
<p>
13131323

@@ -1318,7 +1328,7 @@ Learn the following modules by heart. Just knowing all of the following items wi
13181328
</p>
13191329
</details>
13201330

1321-
### 14. Few special DS
1331+
### 15. Few special DS
13221332
<details><summary></summary>
13231333
<p>
13241334

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import Foundation
2+
3+
/**
4+
* Definition for a binary tree node.
5+
* public class TreeNode {
6+
* public var val: Int
7+
* public var left: TreeNode?
8+
* public var right: TreeNode?
9+
* public init(_ val: Int) {
10+
* self.val = val
11+
* self.left = nil
12+
* self.right = nil
13+
* }
14+
* }
15+
*/
16+
class Solution {
17+
func invertTree(_ root: TreeNode?) -> TreeNode? {
18+
guard let r = root else {
19+
return nil
20+
}
21+
22+
var left = self.invertTree(r.left)
23+
var right = self.invertTree(r.right)
24+
r.left = right
25+
r.right = left
26+
return r
27+
}
28+
}

0 commit comments

Comments
 (0)