当前位置:网站首页>LeetCode 100.相同的树(简单)
LeetCode 100.相同的树(简单)
2022-08-10 05:32:00 【生信研究猿】
python 递归
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def isSameTree(self, p: Optional[TreeNode], q: Optional[TreeNode]) -> bool:
if(p==None and q==None):
return True
if(p==None or q==None):
return False
if(p.val !=q.val):
return False
return self.isSameTree(p.left,q.left) and self.isSameTree(p.right,q.right)

边栏推荐
- 复杂的“元宇宙”,为您解读,链读APP即将上线!
- Linux database Oracle client installation, used for shell scripts to connect to the database with sqlplus
- Collection Map
- 程序员副业赚钱之道,实现月收入增加20K
- wiki confluence installation
- cesium add point, move point
- I use this recruit let the team to improve the development efficiency of 100%!
- 事务、存储引擎
- 树结构——二叉查找树原理与实现
- 优先队列
猜你喜欢
随机推荐
Count down the six weapons of the domestic interface collaboration platform!
ACID四种特性
Using sqlplus to operate database in shell script
第十天作业
测一测异性的你长什么样?
One step ahead, don't miss it again, the chain reading APP will be launched soon!
Chain Reading | The latest and most complete digital collection calendar-07.28
GUI_AWT
文本元素
String common methods
小程序wx.request简单Promise封装
MySQL中MyISAM为什么比InnoDB查询快
各个架构指令集对应的机型
细说MySql索引原理
Multi-table query Notes
数据库 笔记 创建数据库、表 备份
redis常见的面试题
Linux数据库Oracle客户端安装,用于shell脚本用sqlplus连接数据库
树结构——2-3树图解
Set Sources Resources and other folders in the IDEA project







![[Notes] Collection Framework System Collection](/img/6a/f0e69ebb60a3d958ec7bda33a60995.png)

