当前位置:网站首页>力扣刷题 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
边栏推荐
- 淘宝发布宝贝提示“您的消保保证金额度不足,已启动到期保障”
- Oracle view related
- 函数只执行第一次的执行一次 once函数
- Oracle alarm log alert Chinese trace and trace files
- Leetcode | 38 appearance array
- [code analysis (6)] communication efficient learning of deep networks from decentralized data
- JS 烧脑面试题大赏
- elmo(BiLSTM-CRF+elmo)(Conll-2003 命名实体识别NER)
- Dynamic subset division problem
- The difference between is and as in Oracle stored procedure
猜你喜欢

Leetcode | 38 appearance array

Special window function rank, deny_ rank, row_ number

Kettle--控件解析

10g database cannot be started when using large memory host

elmo(BiLSTM-CRF+elmo)(Conll-2003 命名实体识别NER)

UML统一建模语言

Static interface method calls are not supported at language level '5'

Express②(路由)

Leetcode brush question 897 incremental sequential search tree

服务器中挖矿病毒了,屮
随机推荐
Reading notes: Secure federated matrix factorization
AttributeError: ‘dict‘ object has no attribute ‘iteritems‘
剑南春把文字游戏玩明白了
Android interview theme collection
Window function row commonly used for fusion and de duplication_ number
pycharm Install packages failed
Ora-16047 of a DG environment: dgid mismatch between destination setting and target database troubleshooting and listening vncr features
try --finally
[code analysis (1)] communication efficient learning of deep networks from decentralized data
Analysis of the problem that the cluster component GIPC in RAC environment cannot correctly identify the heartbeat network state
Static interface method calls are not supported at language level '5'
Jenkins construction and use
Apache Atlas Compilation and installation records
Oracle calculates the difference between two dates in seconds, minutes, hours and days
Technologie zéro copie
Modify the Jupiter notebook style
初探 Lambda Powertools TypeScript
Influence of openssh version on SSH mutual trust creation in RAC environment
MySQL [SQL performance analysis + SQL tuning]
leetcode--380.O(1) 时间插入、删除和获取随机元素