当前位置:网站首页>力扣刷题 101. 对称二叉树
力扣刷题 101. 对称二叉树
2022-04-23 13:54:00 【Candy_Rainbow_】
var isSymmetric = function(root) {
const isTrue = (left, right) => {//左右子树是不是镜像
if(left == null && right == null)return true;//走到了根节点
if(left == null || right == null)return false;//左右子树有一个不空
if(left.val != right.val)return false;//对称点相等不相等
return isTrue(left.left, right.right) && isTrue(left.right, right.left);//子问题
}
if(root == null)return true;
return isTrue(root.left, root.right);
};
版权声明
本文为[Candy_Rainbow_]所创,转载请带上原文链接,感谢
https://blog.csdn.net/Candy_Rainbow_/article/details/124350738
边栏推荐
- 淘宝发布宝贝提示“您的消保保证金额度不足,已启动到期保障”
- Technologie zéro copie
- Ora-600 encountered in Oracle environment [qkacon: fjswrwo]
- 聯想拯救者Y9000X 2020
- Analysis of unused index columns caused by implicit conversion of timestamp
- PG library checks the name
- Express中间件③(自定义中间件)
- Window function row commonly used for fusion and de duplication_ number
- Analysis of the problem that the cluster component GIPC in RAC environment cannot correctly identify the heartbeat network state
- Leetcode? The first common node of two linked lists
猜你喜欢
Special window function rank, deny_ rank, row_ number
Leetcode? The first common node of two linked lists
Information: 2021 / 9 / 29 10:01 - build completed with 1 error and 0 warnings in 11S 30ms error exception handling
Apache seatunnel 2.1.0 deployment and stepping on the pit
Basic SQL query and learning
JMeter pressure test tool
3300万IOPS、39微秒延迟、碳足迹认证,谁在认真搞事情?
Handling of high usage of Oracle undo
美联储数字货币最新进展
Jenkins construction and use
随机推荐
零拷貝技術
Window analysis function last_ VALUE,FIRST_ VALUE,lag,lead
Parameter comparison of several e-book readers
Oracle alarm log alert Chinese trace and trace files
Analysis of cluster component gpnp failed to start successfully in RAC environment
专题测试05·二重积分【李艳芳全程班】
MySQL [read / write lock + table lock + row lock + mvcc]
Window function row commonly used for fusion and de duplication_ number
Test the time required for Oracle library to create an index with 7 million data in a common way
Express ② (routing)
try --finally
2021年秋招,薪资排行NO
UNIX final exam summary -- for direct Department
10g database cannot be started when using large memory host
Oracle RAC database instance startup exception analysis IPC send timeout
[code analysis (4)] communication efficient learning of deep networks from decentralized data
Analysis of unused index columns caused by implicit conversion of timestamp
Analysis of the problem that the cluster component GIPC in RAC environment cannot correctly identify the heartbeat network state
Dolphin scheduler source package Src tar. GZ decompression problem
函数只执行第一次的执行一次 once函数