当前位置:网站首页>Image of JZ27 binary tree
Image of JZ27 binary tree
2022-07-21 16:36:00 【syc596】
JZ27 Image of binary tree
Image of binary tree _ Niuke Tiba _ Cattle from (nowcoder.com)
//1
// The top-down
import java.util.*;
public class Solution {
public TreeNode Mirror (TreeNode root) {
if(root==null){
return null;
}
TreeNode tmp=root.left;
root.left=root.right;
root.right=tmp;
Mirror(root.left);
Mirror(root.right);
return root;
}
}
// // Bottom up
// import java.util.*;
// public class Solution {
// public TreeNode Mirror (TreeNode root) {
// if(root==null){
// return null;
// }
// Mirror(root.left);
// Mirror(root.right);
// TreeNode tmp=root.left;
// root.left=root.right;
// root.right=tmp;
// return root;
// }
// }
边栏推荐
- What preliminary work does the enterprise need to do to establish its own applet and app?
- Lora technology helps cold chain development
- Lora base station coverage
- Dama Chapter 11 (data warehouse and business intelligence)
- ORA-1142 signalled during: ALTER DATABASE END BACKUP...
- Dam Chapter 13 (data quality management)
- To test / development programmers: programmers who love life, don't work overtime, and are forced
- JZ15 二进制中1的个数
- Set current style dimstyle
- [hardware foundation 4] diode (principle, characteristics, type, circuit analysis)
猜你喜欢
Lora base station coverage
Code implementation of binary tree node number and leaf node number (C language)
Dama Chapter 11 (data warehouse and business intelligence)
What if the download of Duoyu security browser is blocked? Turn off the method of download blocking
Dama Chapter 3 (Data Governance)
Wechat applet - "data binding and event binding"
[toggle 30 days of ML] Diabetes genetic risk detection challenge (1)
Dama Chapter 5 (data modeling and Design)
Let's go - Recruitment book for reading activities in 2022 (issue 1)
Using go TCP to realize simple online group chat function
随机推荐
Translation of UAV intelligent coverage navigation based on DRL in complex geometric environments
Calculate the centrifugal angle according to the center angle of the circle
If no linetype is selected, the reason why cacuilinetypecombobox crashes
i2c adapter驅動
nodejs md5 加盐值
I2C client Drive
JZ25 合并两个排序的链表
After graduation, the three people in beidatong dormitory went to foreign enterprises, state-owned enterprises and entrepreneurship respectively. What do they regret after 10 years
MoviePy error: FFMPEG encountered the following error while writing file
This domestic API artifact tool is too strong Let me give up postman
LabVIEW monitors and plots the voltage, current and energy consumption trend of single crystal photovoltaic panels in real time
Let me introduce you to the partition automatic management of data warehouse
Installing C3d v1.0
How to ensure data security while saving 30% disk space DB · insight
JZ33 二叉搜索树的后序遍历序列
Five reasons why developers use Klocwork for software security
Okaleido tiger NFT is about to log in to binance NFT platform, and the future market continues to be optimistic
[super easy to understand competition questions] 2021 Sichuan University Student Program Design Competition
2022 Shandong vision prevention and control conference, China eye care products exhibition, Jinan myopia correction equipment exhibition
6.1-WY16 不要二