当前位置:网站首页>leetcode - symmetric binary tree
leetcode - symmetric binary tree
2022-08-05 02:43:00 【qq_52025208】
Title description:
Given a binary tree, check if it is mirror-symmetric.
For example, the binary tree [1,2,2,3,4,4,3] is symmetric.
1/
2 2
/ \ /
3 4 4 3
class Solution {public boolean isSymmetric(TreeNode root) {if(root == null) return true;return isSymmetricChild(root.left,root.right)span>;}public boolean isSymmetricChild(TreeNode s,TreeNode t) {if(s == null && t == nullspan>) return true;if(s== null && t != null || s != null && t == null) return false;if(s.val != t.val) return false;return isSymmetricChild(s.left,t.right)span>&&isSymmetricChild(s.right,t.left);}}边栏推荐
- [深入研究4G/5G/6G专题-51]: URLLC-16-《3GPP URLLC相关协议、规范、技术原理深度解读》-11-高可靠性技术-2-链路自适应增强(根据无线链路状态动态选择高可靠性MCS)
- 1873. The special bonus calculation
- 软链接引发的物理备份问题
- 力扣-二叉树的最大的深度
- J9 Digital Currency: What is the creator economy of web3?
- 1484. Sell Products by Date
- 百日刷题计划 ———— DAY2
- Introduction to SDC
- Intel XDC 2022 Wonderful Review: Build an Open Ecosystem and Unleash the Potential of "Infrastructure"
- QStyle平台风格
猜你喜欢

How OpenGL works

Apache DolphinScheduler, a new generation of distributed workflow task scheduling platform in practice - Medium

leetcode 15
![02 [Development Server Resource Module]](/img/60/f77ed0bb0e5654c9dcd70b73a5bee8.png)
02 [Development Server Resource Module]

Common hardware delays

DAY22: sqli-labs shooting range clearance wp (Less01~~Less20)

使用SuperMap iDesktopX数据迁移工具迁移ArcGIS数据

QT语言文件制作

Multithreading (2)

What should I do if the self-incrementing id of online MySQL is exhausted?
随机推荐
Data storage practice based on left-order traversal
【解密】OpenSea免费创造的NFT都没上链竟能出现在我的钱包里?
正则表达式,匹配中间的某一段字符串
[Decryption] Can the NFTs created by OpenSea for free appear in my wallet without being chained?
剑指offer专项突击版第20天
2022-08-04:输入:去重数组arr,里面的数只包含0~9。limit,一个数字。 返回:要求比limit小的情况下,能够用arr拼出来的最大数字。 来自字节。
DAY22: sqli-labs shooting range clearance wp (Less01~~Less20)
常见的硬件延迟
DAY23: Command Execution & Code Execution Vulnerability
使用SuperMap iDesktopX数据迁移工具迁移地图文档和符号
HDU 1114: Piggy-Bank ← The Complete Knapsack Problem
View handler 踩坑记录
Snapback - same tree
Regular expression to match a certain string in the middle
[In-depth study of 4G/5G/6G topic-51]: URLLC-16-"3GPP URLLC related protocols, specifications, and technical principles in-depth interpretation"-11-High reliability technology-2-Link adaptive enhancem
Introduction to SDC
【genius_platform软件平台开发】第七十六讲:vs预处理器定义的牛逼写法!!!!(其他组牛逼conding人员告知这么配置来取消宏定义)
Semi-Decentralized Federated Learning for Cooperative D2D Local Model Aggregation
RAID disk array
Note that Weifang generally needs to pay attention to issuing invoices