mirror of
https://github.com/CyC2018/Interview-Notebook.git
synced 2026-10-30 07:33:45 +00:00
Update 27. 二叉树的镜像.md
题目链接改为力扣中的对应题目,题目描述和代码按该题的接口调整。
This commit is contained in:
+4
-4
@@ -1,6 +1,6 @@
|
||||
# 27. 二叉树的镜像
|
||||
|
||||
[牛客网](https://www.nowcoder.com/practice/a9d0ecbacef9410ca97463e4a5c83be7?tpId=13&tqId=11171&tab=answerKey&from=cyc_github)
|
||||
[Leetcode](https://leetcode.cn/problems/er-cha-shu-de-jing-xiang-lcof/)
|
||||
|
||||
## 题目描述
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
## 解题思路
|
||||
|
||||
```java
|
||||
public TreeNode Mirror(TreeNode root) {
|
||||
public TreeNode flipTree(TreeNode root) {
|
||||
if (root == null)
|
||||
return root;
|
||||
swap(root);
|
||||
Mirror(root.left);
|
||||
Mirror(root.right);
|
||||
flipTree(root.left);
|
||||
flipTree(root.right);
|
||||
return root;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user