【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 复制代码
相关推荐
不会就选b6 小时前
算法日常・每日刷题--<贪心>14
算法
mmmmath_39 小时前
LeetCode.541.反转字符串II
数据结构·算法·leetcode
Navigator_Z9 小时前
LeetCode //MySQL - 1251. Average Selling Price
c语言·算法·leetcode
醇氧10 小时前
MySQL 8.0 系统表损坏与引擎转换故障排查实战
数据结构·算法
大熊背10 小时前
《Color constancy by characterization of illumination chromaticity》之色度色域最大化算法(二)
算法·白平衡·色度·色温
钓鱼的肝10 小时前
梳理(1-5)
c++·经验分享·笔记·算法·青少年编程
参.商.11 小时前
【Day 53】76. 最小覆盖子串
leetcode·golang
HZZD_HZZD11 小时前
CSDN_批发市场水电漏损归因算法LAM的原理与落地
嵌入式硬件·物联网·算法
shirsl12 小时前
算法 Day 5 树 / 二叉树 + DFS
数据结构·python·算法