【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 复制代码
相关推荐
碧海银沙音频科技研究院2 小时前
炬芯ATS3089X手表的HFP通话不自动路由到设备BT的问题解决
网络·人工智能·嵌入式硬件·算法
mmmmath_37 小时前
LeetCode.199.二叉树的右视图
数据结构·leetcode
专注仿真7 小时前
引擎扩展性与集成设计深度剖析:从 14 个扩展点到 DIS→HLA 演进之路
开发语言·算法·仿真引擎·推演引擎
码爸7 小时前
支持向量机介绍与示例
算法·机器学习·支持向量机
怕浪猫7 小时前
2028编程圈很火的10个Skills
算法·面试·github
Nil20812 小时前
leetcode 198打家劫舍
算法·leetcode·职场和发展
Shaoshing12 小时前
前缀和与差分
java·数据结构·算法·前缀和·差分
mmmmath_312 小时前
LeetCode.429.N叉树的层序遍历
数据结构·leetcode
loulanyue_12 小时前
构建房产认知决策智能:Harness底座与AI自进化的技术实践——读贝壳首席算法科学家尹俊希2026云栖专场演讲
人工智能·算法