当前位置:网站首页>牛客-TOP101-BM35
牛客-TOP101-BM35
2022-07-23 12:03:00 【一条吃猫的鱼】
import java.util.*;
/* * public class TreeNode { * int val = 0; * TreeNode left = null; * TreeNode right = null; * public TreeNode(int val) { * this.val = val; * } * } */
public class Solution {
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param root TreeNode类 * @return bool布尔型 */
public boolean isCompleteTree (TreeNode root) {
// write code here
if(root == null)
return true;
Deque<TreeNode> deque = new LinkedList<>();
deque.addLast(root);
boolean sign = false;
TreeNode t;
while(!deque.isEmpty()){
t = deque.pollFirst();
if(t == null){
sign = true;
continue;
}
if(sign)
return false;
deque.offerLast(t.left);
deque.offerLast(t.right);
}
return true;
}
}
边栏推荐
- 冒泡排序-看着一篇就够啦
- redis 主从复制
- Governance and network security of modern commercial codeless development platform
- [paper study] source mixing and separation robot audio steganography
- 7、 Logic of JMeter sending request
- 再获殊荣 | OpenSCA获选中国软博会“全球十大开源软件产品”
- ECS remote monitoring
- How to become an elegant Hardware Engineer?
- MySQL-字符串按照数值排序
- High cost performance, high anti-interference touch IC that meets a variety of keys: vk3606d, vk3610i, vk3618i have high power voltage rejection ratio
猜你喜欢
![[operation and maintenance] SSH tunneling relies on the 22 port of SSH to realize the interface service of accessing the remote server](/img/4a/7156470e8d96c7709001bac88e872c.png)
[operation and maintenance] SSH tunneling relies on the 22 port of SSH to realize the interface service of accessing the remote server

大端模式和小端模式的记忆方法

After effects tutorial, how to create animation in after effects?

云原生(十一) | Kubernetes篇之Kubernetes原理与安装

Bug modification

Origin of bean validation ----01

Vinka推出高抗干扰VK36N系列触摸IC:VK36N1D,VK36N2P,VK36N3B,VK36N4I 使用便利

七、jmeter发出请求的逻辑

SSB signal modulation and demodulation based on MATLAB (with source code)

Bean validation core components - 04
随机推荐
上课作业(5)——#576. 饥饿的牛(hunger)
Packaging and use of fmdb
MySQL - six logs
Bean Validation核心組件篇----04
Bubble sort - just read one
CONDA set up proxy
C language learning notes
V自P建N_部署使用
Mathematical Modeling Typesetting
MySQL string sorted by numeric value
Learning summary of ugly code
Expression du suffixe (une question par jour pendant les vacances d'été 4)
redis 哨兵模式
Three handling strategies of deadlock
redis 主从复制
ICML 2022 | 稀疏双下降:网络剪枝也能加剧模型过拟合?
“1+1>10”:无代码/低代码与RPA技术的潜在结合
Mysql—六大日志
Google Earth Engine——影像统计过程中出现的空值问题
Vinka推出高抗干扰VK36N系列触摸IC:VK36N1D,VK36N2P,VK36N3B,VK36N4I 使用便利