【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 复制代码
相关推荐
ly-272533 分钟前
IEEE PDF eXpress终稿检测踩坑记录:PDF图片字体未嵌入与LaTeX参考文献编译异常解决方法
服务器·人工智能·算法
代码不停11 分钟前
子序列问题
java·算法
黎阳之光27 分钟前
AI黑光相机|赋能低空全域感知,筑牢低空经济全天候视觉防线
人工智能·物联网·算法·安全·数字孪生
手写码匠35 分钟前
华为云Flexus+DeepSeek征文|DeepSeek R1 推理优化实战:让复杂任务的回答又快又稳
人工智能·深度学习·算法·aigc
Cabbage_acmer36 分钟前
cf训练-gpt
算法
wenyq740 分钟前
LeetCode 438. Find All Anagrams in a String
算法·leetcode
LB211241 分钟前
力扣102 198 70 55
数据结构·算法·leetcode
鹿角片ljp1 小时前
LeetCode 42:接雨水|前后最大值DP
算法·leetcode·动态规划
北域码匠9 小时前
高通滤波算法深度解析(High-Pass Filter)
stm32·算法·c#·数字信号处理·嵌入式开发·滤波算法·高通滤波