当前位置:网站首页>LeetCode 100. The same tree (simple)
LeetCode 100. The same tree (simple)
2022-08-10 05:56:00 【Shengxin Research Ape】
python recursion
# 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 = rightclass Solution:def isSameTree(self, p: Optional[TreeNode], q: Optional[TreeNode]) -> bool:if(p==None and q==None):return Trueif(p==None or q==None):return Falseif(p.val !=q.val):return Falsereturn self.isSameTree(p.left,q.left) and self.isSameTree(p.right,q.right)
边栏推荐
- LeetCode 1351.统计有序矩阵中的负数(简单)
- Pytorch配置与实战--Tips
- 一个基于.Net Core 开源的物联网基础平台
- 微信小程序-小程序的宿主环境
- LeetCode 剑指offer 21.调整数组顺序使奇数位于偶数前面(简单)
- Mini Program Study Notes: Communication between Mini Program Components
- 符号表
- 【List练习】遍历集合并且按照价格从低到高排序,
- Bifrost micro synchronous database implementation services across the library data synchronization
- tinymce rich text editor
猜你喜欢
随机推荐
error in ./node_modules/cesium/Source/ThirdParty/zip.js
学生管理系统以及其简单功能的实现
Notes 1
Notes for SVM
MySql 约束
测一测异性的你长什么样?
基于MNIST数据集的简单FC复现
多表查询 笔记
国内数字藏品投资价值分析
Chain Reading Good Article: Jeff Garzik Launches Web3 Production Company
pytorch-11. Convolutional Neural Network (Advanced)
Collection set interface
pytorch-06.逻辑斯蒂回归
2022李宏毅机器学习hw1--COVID-19 Cases Prediction
堆的原理与实现以及排序
并查集原理与API设计
Notes for Netual Network
WeChat applet wx.writeBLECharacteristicValue Chinese character to buffer problem
cesium rotate image
pytorch-07.处理多维特征的输入








