当前位置:网站首页>617. merge binary tree
617. merge binary tree
2022-06-11 06:29:00 【Saucey_ six】
subject :
Answer key :
Ideas :(1) recursive (2) The tree is traversed in sequence , Set up null The node of is 0, Add two numbers
Code :
// recursive
var mergeTrees = function (t1, t2) {
if (t1 === null) return t2;
if (t2 === null) return t1;
t1.val += t2.val;
t1.left = mergeTrees(t1.left, t2.left);
t1.right = mergeTrees(t1.right, t2.right);
return t1;
};
(ps: Fifth day )
边栏推荐
- PHP laravel8 send email
- Ethical discussion on reptile Technology
- 022 basic introduction to redis database 0
- Use meshlab to sample the point cloud of CAD model and display it in PCL
- Shandong University machine learning final 2021
- Wechat applet (authorized login of TP5)
- FPGA面試題目筆記(四)—— 序列檢測器、跨時鐘域中的格雷碼、乒乓操作、降低靜動態損耗、定點化無損誤差、恢複時間和移除時間
- Autojs, read one line, delete one line, and stop scripts other than your own
- Shandong University machine learning experiment 7 pca+ SVM face recognition
- jenkins-用户权限管理
猜你喜欢

UEFI finding PCI devices

PHP laravel8 send email

FPGA interview topic notes (I) - FPGA development process, metastable state and competitive risk, build and hold time, asynchronous FIFO depth, etc

Matlab实现均值滤波与FPGA进行对比,并采用modelsim波形仿真

Scripy web crawler series tutorials (I) | construction of scripy crawler framework development environment

Transfer Learning

Convert multiple pictures into one NPY file storage

FPGA面试题目笔记(一)——FPGA开发流程、亚稳态和竞争冒险、建立保持时间、异步FIFO深度等

通过两种方式手写一个消息队列

ERROR 1215 (HY000): Cannot add foreign key constraint
随机推荐
Learn C language well from keywords
Use meshlab to sample the point cloud of CAD model and display it in PCL
QT socket设置连接超时时间
Handwritten a message queue in two ways
FIFO最小深度计算的题目合集
Simple understanding of pseudo elements before and after
懒加载,预加载
A collection of problems on improving working frequency and reducing power consumption in FPGA design
Chapter 6 of machine learning [series] random forest model
Using Metasploit Trojan horse for remote control
What is sentinel produced by Ali?
break,continue有什么区别和用法?
Verilog realizes binocular camera image data acquisition and Modelsim simulation, and finally matlab performs image display
[]==![]
Shandong University machine learning experiment 5 SVM
使用Meshlab对CAD模型采样点云,并在PCL中显示
Autojs, read one line, delete one line, and stop scripts other than your own
A piece of code has been refactored six times by the boss, and my mind is broken
Docker installation of MySQL and redis
山东大学项目实训之examineListActivity