当前位置:网站首页>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)
边栏推荐
猜你喜欢
IO流【】【】【】
分享一款恋爱星座男女配对微信小程序源码
链表API设计
反射【笔记】
数据库 笔记 创建数据库、表 备份
一个基于.Net Core 开源的物联网基础平台
Count down the six weapons of the domestic interface collaboration platform!
PyTorch之模型定义
LeetCode 1894. Find the student number that needs to be supplemented with chalk
The way for programmers to make money from a sideline business and increase their monthly income by 20K
随机推荐
堆的原理与实现以及排序
学生管理系统以及其简单功能的实现
索引笔记【】【】
LeetCode 94. Inorder Traversal of Binary Trees (Simple)
cesium listens to map zoom or zoom to control whether the content added on the map is displayed
Common class String overview
Operation table Function usage
PyTorch之CV
Using sqlplus to operate database in shell script
pytorch-06.逻辑斯蒂回归
ORACLE系统表空间SYSTEM占满无法扩充表空间问题解决过程
【笔记】集合框架体系 Collection
LeetCode 938. Range Sum of Binary Search Trees (Simple)
LeetCode 1720. Decoding XORed Arrays (Simple)
微信小程序--模板与设置WXML
一个基于.Net Core跨平台小程序考试系统
pytorch-06. Logistic regression
String常用方法
视图【】【】【】【】
The Principle of Union Search and API Design