【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 复制代码
相关推荐
HEJOO94 分钟前
Linux 设备驱动系列——使用全局工作队列
java·linux·算法
Code_Solitude17 分钟前
c语言:递归
java·c语言·算法
我命由我123451 小时前
Photoshop - Photoshop 使用内容识别填充移除对象
学习·职场和发展·产品运营·求职招聘·职场发展·学习方法·photoshop
edtoplort1 小时前
OpenAI紧急叫停GPT-6.1 Astra训练,奥尔特曼为何踩刹车
人工智能·gpt·算法
蒜香可达鸭1 小时前
让视频生成流水线跑不崩:一个事件溯源的多 Agent 可靠执行框架
算法
小羊没烦恼!2 小时前
系统内部模块(子系统)之间的耦合以及模块(子系统)划分
java·开发语言·前端·数据库·算法·c#
Nebula_g2 小时前
JavaSE拓展:Arrays和Collections工具类
java·开发语言·算法·排序算法·工具类·javase·技术栈
菜鸟~noob2332 小时前
【电子战】 第22篇:误差椭圆与置信区间【含matlab代码】
开发语言·算法·matlab
weixin_307779132 小时前
C++代码实现MATLAB中的normalize函数功能
开发语言·c++·算法·matlab
不会就选b2 小时前
算法日常・每日刷题--<动态规划>11
算法