Skip to content

Commit 95d8b14

Browse files
committed
update readme
1 parent a902fe1 commit 95d8b14

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

Algorithm/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
3. [删除链表中的重复元素](https://www.zybuluo.com/Scrazy/note/720542)
44
4. [数组中的数组成最小值](https://www.zybuluo.com/Scrazy/note/720582)
55
5. [索引为index 的丑数](https://www.zybuluo.com/Scrazy/note/720587)
6+
6. [反转链表](https://www.zybuluo.com/Scrazy/note/721436)

binary_tree.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,3 +328,27 @@ class Solution:
328328
return True
329329
return is_same(pRoot.left, pRoot.right)
330330
```
331+
### 二叉树镜像
332+
333+
```
334+
# -*- coding:utf-8 -*-
335+
# class TreeNode:
336+
# def __init__(self, x):
337+
# self.val = x
338+
# self.left = None
339+
# self.right = None
340+
class Solution:
341+
# 返回镜像树的根节点
342+
def Mirror(self, root):
343+
# write code here
344+
if not root:
345+
return None
346+
elif not (root.left or root.right):
347+
return root
348+
349+
root.left, root.right = root.right, root.left
350+
if root.left:
351+
self.Mirror(root.left)
352+
if root.right:
353+
self.Mirror(root.right)
354+
```

0 commit comments

Comments
 (0)