当前位置:网站首页>剑指offer刷题记录1
剑指offer刷题记录1
2022-07-06 14:45:00 【马孔多镇长】
剑指offer刷题记录
101. 对称二叉树
️ 给你一个二叉树的根节点 root , 检查它是否轴对称
️ 示例1:

输入:root = [1,2,2,3,4,4,3] 输出:true
️ 示例2:

输入:root = [1,2,2,null,3,null,3] 输出:false
️ 提示:
树中节点数目在范围
[1, 1000]内-100 <= Node.val <= 100
class Solution {
public boolean isSymmetric(TreeNode root) {
if(root==null){
return true;
}
return isMirror(root,root);
}
boolean isMirror(TreeNode r1,TreeNode r2){
if(r1==null&&r2==null){
return true;
}
if(r1==null||r2==null){
return false;
}
return (r1.val==r2.val)&&isMirror(r1.left,r2.right)&&isMirror(r1.right,r2.left);
}
}
边栏推荐
- ZABBIX proxy server and ZABBIX SNMP monitoring
- CCNA-思科网络 EIGRP协议
- C # realizes crystal report binding data and printing 4-bar code
- Attack and defense world ditf Misc
- 小程序系统更新提示,并强制小程序重启并使用新版本
- 图像的spatial domain 和 frequency domain 图像压缩
- HDU 2008 digital statistics
- BarcodeX(ActiveX打印控件) v5.3.0.80 免费版使用
- Insert sort and Hill sort
- 12、 Start process
猜你喜欢

PVL EDI 项目案例

Senior soft test (Information System Project Manager) high frequency test site: project quality management

剪映+json解析将视频中的声音转换成文本

微信红包封面小程序源码-后台独立版-带测评积分功能源码

Memorabilia of domestic database in June 2022 - ink Sky Wheel

Netxpert xg2 helps you solve the problem of "Cabling installation and maintenance"

3DMAX assign face map

CCNA Cisco network EIGRP protocol

3DMax指定面贴图

Xiaoman network model & http1-http2 & browser cache
随机推荐
Assembly and Interface Technology Experiment 6 - ADDA conversion experiment, AD acquisition system in interrupt mode
ResNet-RS:谷歌领衔调优ResNet,性能全面超越EfficientNet系列 | 2021 arxiv
About the professional ethics of programmers, let's talk about it from the way of craftsmanship and neatness
柔性数组到底如何使用呢?
void关键字
HDR image reconstruction from a single exposure using deep CNNs阅读札记
HDU 2008 digital statistics
qt quick项目offscreen模式下崩溃的问题处理
LeetCode刷题(十一)——顺序刷题51至55
2022-07-04 mysql的高性能数据库引擎stonedb在centos7.9编译及运行
Learn the principle of database kernel from Oracle log parsing
Data processing skills (7): MATLAB reads the data in the text file TXT with mixed digital strings
CCNA-思科网络 EIGRP协议
lora同步字设置
extern关键字
i.mx6ull搭建boa服务器详解及其中遇到的一些问题
Force deduction question 500, keyboard line, JS implementation
Management background --3, modify classification
2020 Bioinformatics | GraphDTA: predicting drug target binding affinity with graph neural networks
Support multiple API versions in flask