当前位置:网站首页>[leetcode refers to offer 27. Image of binary tree (simple)]
[leetcode refers to offer 27. Image of binary tree (simple)]
2022-04-23 21:02:00 【Minaldo7】
subject :
source : Power button (LeetCode)
link :https://leetcode-cn.com/problems/er-cha-shu-de-jing-xiang-lcof
Copyright belongs to the network . For commercial reprint, please contact the official authority , Non-commercial reprint please indicate the source .
The problem solving process :
/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */
class Solution {
public TreeNode mirrorTree(TreeNode root) {
if(root == null) return root;
TreeNode temp = root.right ;
root.right = root.left;
root.left = temp ;
mirrorTree(root.left);
mirrorTree(root.right);
return root;
}
}
Execution results :
版权声明
本文为[Minaldo7]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/111/202204210544479652.html
边栏推荐
- go interface
- ubutnu20安装CenterNet
- Explore ASP Net core read request The correct way of body
- South Korea may ban apple and Google from offering commission to developers, the first in the world
- Awk print special characters
- Factory mode
- Matlab matrix index problem
- Presto on spark supports 3.1.3 records
- Automatic heap dump using MBean
- opencv应用——以图拼图
猜你喜欢
电脑越用越慢怎么办?文件误删除恢复方法
浅谈数据库设计之三大范式
Sharpness difference (SD) calculation method of image reconstruction and generation domain index
C#,打印漂亮的贝尔三角形(Bell Triangle)的源程序
[SQL] string series 2: split a string into multiple lines according to specific characters
thinkphp5+数据大屏展示效果
What about laptop Caton? Teach you to reinstall the system with one click to "revive" the computer
一些接地气的话儿
Use 3080ti to run tensorflow GPU = 1 X version of the source code
Amazon and epic will be settled, and the Microsoft application mall will be opened to third parties
随机推荐
Unit function expansion
CUDA, NVIDIA driver, cudnn download address and version correspondence
Explore ASP Net core read request The correct way of body
flomo软件推荐
Ubuntu 20 installing centernet
MySQL进阶之数据的增删改查(DML)
引入结构化并发,Swift 5.5 发布!
危机即机遇,远程办公效率为何会提升?
软件测试要怎么学?自学还是培训看完这篇文章你就懂了
Identifier CV is not defined in opencv4_ CAP_ PROP_ FPS; CV_ CAP_ PROP_ FRAME_ COUNT; CV_ CAP_ PROP_ POS_ Frames problem
Reference of custom message in ROS function pack failed
Zhongchuang storage | how to choose a useful distributed storage cloud disk
Valueerror: invalid literal for int() with base 10 conversion error related to data type
小米手机全球已舍弃“MI”品牌,全面改用“xiaomi”全称品牌
On the three paradigms of database design
On IRP from the perspective of source code
居家第二十三天的午饭
Common commands of MySQL in Linux
C# 知识