【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 小时前
Flutter鸿蒙开发指南(七):轮播图搜索框和导航栏
算法·flutter·图搜索算法
张祥6422889042 小时前
误差理论与测量平差基础笔记十
笔记·算法·机器学习
踩坑记录2 小时前
leetcode hot100 2.两数相加 链表 medium
leetcode·链表
qq_192779873 小时前
C++模块化编程指南
开发语言·c++·算法
cici158745 小时前
大规模MIMO系统中Alamouti预编码的QPSK复用性能MATLAB仿真
算法·matlab·预编码算法
历程里程碑5 小时前
滑动窗口---- 无重复字符的最长子串
java·数据结构·c++·python·算法·leetcode·django
2501_940315266 小时前
航电oj:首字母变大写
开发语言·c++·算法
CodeByV6 小时前
【算法题】多源BFS
算法
TracyCoder1236 小时前
LeetCode Hot100(18/100)——160. 相交链表
算法·leetcode
浒畔居6 小时前
泛型编程与STL设计思想
开发语言·c++·算法