当前位置:网站首页>572. 另一个树的子树
572. 另一个树的子树
2022-06-11 06:23:00 【Saucey_6】
题目:
思路:递归
代码:
var isSubtree = function (s, t) {
if (!s) return false
if (isSub(s, t)) return true
return isSubtree(s.left, t) || isSubtree(s.right, t)
function isSub(treeS, treeT) {
if (!treeS && !treeT) return true
if (!treeS || !treeT) return false
if (treeT.val !== treeS.val) return false
return isSub(treeS.left, treeT.left) && isSub(treeS.right, treeT.right)
}
};
(ps:第四天)
边栏推荐
- Notes sur les questions d'entrevue de la FPGA (IV) - - détecteur de séquence, Code gris dans le domaine de l'horloge croisée, opération de ping - pong, réduction de la perte statique et dynamique, err
- 不同VLAN间的通信
- Alias the path with the help of craco
- FPGA面试题目笔记(四)—— 序列检测器、跨时钟域中的格雷码、乒乓操作、降低静动态损耗、定点化无损误差、恢复时间和移除时间
- ERROR 1215 (HY000): Cannot add foreign key constraint
- Invert an array with for
- On cursor in MySQL
- 箭头函数的this指向
- FPGA面试题目笔记(二)——同步异步D触发器、静动态时序分析、分频设计、Retiming
- Free get | full function version of version control software
猜你喜欢
![[reading this article is enough!!! Easy to understand] confidence level understanding (95% confidence level and confidence interval)](/img/d6/e61ba5bad2b2847378c4547ce0780d.jpg)
[reading this article is enough!!! Easy to understand] confidence level understanding (95% confidence level and confidence interval)
![[must see for game development] 3-step configuration p4ignore + wonderful Q & A analysis (reprinted from user articles)](/img/4c/42933ac0fde18798ed74a23279c826.jpg)
[must see for game development] 3-step configuration p4ignore + wonderful Q & A analysis (reprinted from user articles)

FPGA interview notes (II) -- synchronous asynchronous D flip-flop, static and dynamic timing analysis, frequency division design, retiming

解决ffmpeg获取AAC音频文件duration不准

break,continue有什么区别和用法?

A multi classification model suitable for discrete value classification -- softmax regression

Review XML and JSON
![Chapter 2 of machine learning [series] logistic regression model](/img/8f/b4c302c0309f5c91c7a40e682f9269.jpg)
Chapter 2 of machine learning [series] logistic regression model

How to use the markdown editor

Vulnhub's breach1.0 range exercise
随机推荐
Ethical discussion on reptile Technology
Review XML and JSON
347. top k high frequency elements
Installing and using sublist3r in Kali
Simple understanding of pseudo elements before and after
FPGA面试题目笔记(三)——跨时钟域中握手信号同步的实现、任意分频、进制转换、RAM存储器等、原码反码和补码
Moteur de modèle de moteur thymeleaf
Observer mode (listener mode) + thread pool to realize asynchronous message sending
Use meshlab to sample the point cloud of CAD model and display it in PCL
Jenkins different styles of project construction
CCF 2013 12-4 interesting numbers
Login and registration based on servlet, JSP and MySQL
Sqli-libs post injection question 11-17 actual combat
Global case | how an airline with a history of 100 years can expand and transform to promote innovation in the aviation industry
How to use perforce helix core with CI build server
jenkins-不同风格的项目构建
Sentinel annotation support - @sentinelresource usage details
Detailed installation instructions for MySQL
ERROR 1215 (HY000): Cannot add foreign key constraint
Cenos7 builds redis-3.2.9 and integrates jedis