【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 复制代码
相关推荐
地平线开发者4 小时前
profiler debug 工具用法与高一致性策略
算法·自动驾驶
编程大师哥4 小时前
匿名函数 lambda + 高阶函数
java·python·算法
我叫袁小陌4 小时前
算法解题思路指南
算法
地平线开发者5 小时前
Conv+BN+Add+ReLU 融合机制简介
算法·自动驾驶
yuanyuan2o25 小时前
模型预训练:Hugging Face Transformers 基础
算法·ai·语言模型·自然语言处理·nlp·深度优先
杨充5 小时前
1.3 浮点型数据设计灵魂
开发语言·python·算法
妄想出头的工业炼药师5 小时前
GS slam mono
算法·开源
_日拱一卒6 小时前
LeetCode:207课程表
java·数据结构·算法·leetcode·职场和发展
jiayong237 小时前
AI架构师面试题库 - 完整汇总文档
人工智能·面试·职场和发展