【LeetCode 0102】【BSF】二叉树的层级遍历

  1. Binary Tree Level Order Traversal

Given the root of a binary tree, return the level order traversal of its nodes' values. (i.e., from left to right, level by level).

Example 1:

复制代码
**Input:** root = [3,9,20,null,null,15,7]
**Output:** [[3],[9,20],[15,7]]

Example 2:

复制代码
**Input:** root = [1]
**Output:** [[1]]

Example 3:

复制代码
**Input:** root = []
**Output:** []

Constraints:

  • The number of nodes in the tree is in the range [0, 2000].
  • -1000 <= Node.val <= 1000
Idea
text 复制代码
借助于栈,实现BSF
javascript 复制代码
相关推荐
papaofdoudou几秒前
初中数学-整数整除判定法全解:从 2 到 19 的方法、依据与证明
算法
让学习成为一种生活方式10 分钟前
啤酒花基因组与重测序--Nature Communications
人工智能·算法
l1t28 分钟前
DeepSeek总结的OpenZL压缩变换器
c++·算法
想吃火锅100529 分钟前
【leetcode】238.除了自身以外数组的乘积js
javascript·算法·leetcode
坤坤子吖1 小时前
算法学习——高精度加减乘除
c++·笔记·学习·算法
CQU_JIAKE1 小时前
10.1[A]2267,磐久UMX【上下文128K,KVCache部分]
算法
朝朝辞暮i1 小时前
C++ 第 14 课:引用 &
开发语言·c++·算法
Joe_Wang51 小时前
【从0到1学习JVM · 21】既不浪费空间又没有碎片,标记整理算法到底慢在哪
jvm·学习·算法·垃圾回收·标记整理算法
让学习成为一种生活方式1 小时前
PlantCellChat--单细胞与空间转录组数据预测植物细胞间通讯的R包--The Plant Journal
算法
C++ 老炮儿的技术栈2 小时前
有符号变量与无符号变量的区别
服务器·开发语言·前端·数据结构·c++·算法·c