【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 复制代码
相关推荐
alxraves12 小时前
超声诊断图像的关键算法概述
算法·安全·健康医疗·制造·信号处理
mask哥12 小时前
15种算法模式java实现详解
java·算法·力扣
若尘79712 小时前
数学idea的重构
算法·职场和发展·机器人
思茂信息12 小时前
CST可重构雷达吸波器设计与仿真
网络·算法·平面·智能手机·重构·cst·电磁仿
游乐码12 小时前
c#插入排序
数据结构·算法·排序算法
乐迪信息12 小时前
乐迪信息:AI防爆摄像机,船舶偏航逆行算法实时告警零漏检
大数据·人工智能·物联网·算法·机器学习·计算机视觉·目标跟踪
昵称小白13 小时前
图论专题(上)
算法·深度优先·图论
victory043113 小时前
面试知识点 1 2 3复印版本
面试·职场和发展
大大杰哥13 小时前
leetcode hot100(2)双指针,滑动窗口
数据结构·算法·leetcode
风筝在晴天搁浅13 小时前
LeetCode CodeTop 113.路径总和Ⅱ
算法·leetcode