当前位置:网站首页>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);}}边栏推荐
猜你喜欢

2022-08-04:输入:去重数组arr,里面的数只包含0~9。limit,一个数字。 返回:要求比limit小的情况下,能够用arr拼出来的最大数字。 来自字节。

线性表的查找

Gantt chart is here, project management artifact, template is used directly

DAY23:命令执行&代码执行漏洞
![[Decryption] Can the NFTs created by OpenSea for free appear in my wallet without being chained?](/img/81/2dcb61fd6c30f726804c73cf2b3384.jpg)
[Decryption] Can the NFTs created by OpenSea for free appear in my wallet without being chained?

How OpenGL works

lua learning

线上MySQL的自增id用尽怎么办?

特殊矩阵的压缩存储

Advanced Numbers_Review_Chapter 1: Functions, Limits, Continuity
随机推荐
[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
从零到一快速学会三子棋
matlab绘制用颜色表示模值大小的箭头图
云原生(三十二) | Kubernetes篇之平台存储系统介绍
Optimizing the feed flow encountered obstacles, who helped Baidu break the "memory wall"?
Regular expression to match a certain string in the middle
虚拟内存原理与技术
Semi-Decentralized Federated Learning for Cooperative D2D Local Model Aggregation
树表的查找
post-study program
采用redis缓存的linux主从同步服务器图片硬盘满了移到新目录要修改哪些指向
PostgreSQL数据库 用navicat 打开表结构的时候报错 cannot update secondarysnapshot during a parallel operation 怎么解决?
优炫数据库的单节点如何转集群
1667. 修复表中的名字
nodeJs--封装路由
02 [Development Server Resource Module]
22-07-31周总结
【日常训练】1403. 非递增顺序的最小子序列
nodeJs--encapsulate routing
[机缘参悟-60]:《兵者,诡道也》-2-孙子兵法解读