当前位置:网站首页>Force deduction brush question 101 Symmetric binary tree
Force deduction brush question 101 Symmetric binary tree
2022-04-23 13:56:00 【Candy_ Rainbow_】
var isSymmetric = function(root) {
const isTrue = (left, right) => {// Whether the left and right subtrees are mirror images
if(left == null && right == null)return true;// Went to the root node
if(left == null || right == null)return false;// One of the left and right subtrees is not empty
if(left.val != right.val)return false;// The points of symmetry are equal but not equal
return isTrue(left.left, right.right) && isTrue(left.right, right.left);// Sub problem
}
if(root == null)return true;
return isTrue(root.left, root.right);
};
版权声明
本文为[Candy_ Rainbow_]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231353588847.html
边栏推荐
- Failure to connect due to improper parameter setting of Rac environment database node. Troubleshooting
- crontab定时任务输出产生大量邮件耗尽文件系统inode问题处理
- RAC environment error reporting ora-00239: timeout waiting for control file enqueue troubleshooting
- Oracle clear SQL cache
- Oracle index status query and index reconstruction
- 2022年江西最新建筑八大员(质量员)模拟考试题库及答案解析
- [code analysis (6)] communication efficient learning of deep networks from decentralized data
- 第一章 电商秒杀商品回顾
- RAC environment alert log error drop transient type: systp2jw0acnaurdgu1sbqmbryw = = troubleshooting
- [machine learning] Note 4. KNN + cross validation
猜你喜欢
随机推荐
[code analysis (5)] communication efficient learning of deep networks from decentralized data
Express ② (routing)
leetcode--977. Squares of a Sorted Array
elmo(BiLSTM-CRF+elmo)(Conll-2003 命名实体识别NER)
Atcoder beginer contest 248c dice sum (generating function)
RAC environment alert log error drop transient type: systp2jw0acnaurdgu1sbqmbryw = = troubleshooting
UNIX final exam summary -- for direct Department
PG library to view the distribution keys of a table in a certain mode
pycharm Install packages failed
淘宝发布宝贝提示“您的消保保证金额度不足,已启动到期保障”
Function executes only the once function for the first time
Express ② (routage)
2021年秋招,薪资排行NO
Reading notes: Secure federated matrix factorization
Leetcode brush question 897 incremental sequential search tree
解决方案架构师的小锦囊 - 架构图的 5 种类型
Multithreading
Ora-600 encountered in Oracle environment [qkacon: fjswrwo]
Oracle database recovery data
The difference between is and as in Oracle stored procedure

![MySQL [read / write lock + table lock + row lock + mvcc]](/img/a9/ace85899a01a7d4fd80b2e631e44d6.png)







