当前位置:网站首页>2022.7.25-----leetcode.919
2022.7.25-----leetcode.919
2022-07-26 02:05:00 【路Lu727】
TreeNode root;
Deque<TreeNode> q;//存储最后一个节点的父节点到最后节点
public CBTInserter(TreeNode root) {
this.root=root;
q=new ArrayDeque<>();
if(root!=null)
q.add(root);
while(!q.isEmpty()){
TreeNode n=q.getFirst();
if(n.left!=null)
q.add(n.left);
else break;
if(n.right!=null)
q.add(n.right);
else break;
q.poll();
}
}
public int insert(int val) {
TreeNode n=q.getFirst();
if(n.left==null){
n.left=new TreeNode(val);
q.add(n.left);
}else{
n.right=new TreeNode(val);
q.add(n.right);
q.poll();
}
return n.val;
}
public TreeNode get_root() {
return root;
}边栏推荐
- js给页面添加随机像素噪声背景
- SQL手工盲注、报错注入
- [2021] [paper notes] biological effects of cell membrane under infrared and THz - effect is a phenomenon, action is a mechanism - the benefits of THz to medicine
- (CVPR 2019) GSPN: Generative Shape Proposal Network for 3D Instance Segmentation in Point Cloud
- 1. Mx6ul core module use serial -rs485 test (x)
- Ti am335x industrial control module uses the Debian system of beaglebone (BBB)
- mysql 事务隔离级别
- [C language brush leetcode] 1604. Warn people who use the same employee card more than or equal to three times within an hour (m)
- Infinite fraction path (BFS pruning)
- I.MX6UL核心模块使用连载-RS485测试 (十)
猜你喜欢

Activiti workflow gateway

Are you still using ==0 null equal to judge null values? How much do you know about isempty and isblank

vite 本地运行首次进入页面加载慢问题

A pluggable am335x industrial control module onboard WiFi module

Create a future and enjoy extraordinary | gbase Nantah General Motors unveiled opengauss Developer Day 2022

QT program beautification of the use of style sheets, QT uses pictures as the background and transparency of controls, QT custom button styles
![[2019] [paper notes] tunable THz broadband absorption based on metamaterials——](/img/ae/bbebba30d0d6f58d65531cff48b5e9.png)
[2019] [paper notes] tunable THz broadband absorption based on metamaterials——

SQL manual blind injection and error reporting injection

TI AM335x工控模块网络跟文件系统NFS的实现

【2020】【论文笔记】磁控溅射法生长Bi2Te3/CoFeB双层异质结——
随机推荐
Zhinai buys melons (DP backpack)
BGP knowledge points summary
Worthington papain - production of glycopeptides from purified proteoglycans (attached Literature)
A MCU event driven C framework
本地仓库导致的报错
The import and Export button of Damon database table is gray, and the DMP file cannot be imported
Republishing foundation and configuration
19_请求表单与文件
1. Mx6ul core module serial Ethernet test (VII)
What is JSX?
[2021] [paper notes] 6G technology vision - otfs modulation technology
Worthington核酸酶、微球菌相关研究及测定方案
1. Mx6ul core module uses serial can and buzzer test (XI)
[C language brush leetcode] 1604. Warn people who use the same employee card more than or equal to three times within an hour (m)
【2020】【论文笔记】磁控溅射法生长Bi2Te3/CoFeB双层异质结——
Dest0g3 520 orientation (under update)
Master-slave replication in MySQL
2022-07-17
How to choose cloud note tool? What can I do with cloud notes?
1205 Lock wait timeout exceeded; try restarting transaction处理