【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
借助于栈,实现BSF

相关推荐

  1. Leetcode 107:层次II

    2024-07-13 11:32:03       27 阅读
  2. Leetcode 102:层次

    2024-07-13 11:32:03       26 阅读
  3. Leetcode 429:N层次

    2024-07-13 11:32:03       26 阅读
  4. leetcode-11-前中后序以及层次

    2024-07-13 11:32:03       27 阅读
  5. 层次

    2024-07-13 11:32:03       117 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-13 11:32:03       67 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-13 11:32:03       71 阅读
  3. 在Django里面运行非项目文件

    2024-07-13 11:32:03       58 阅读
  4. Python语言-面向对象

    2024-07-13 11:32:03       69 阅读

热门阅读

  1. R语言学习笔记6-数据框

    2024-07-13 11:32:03       20 阅读
  2. 菜鸡的原地踏步史07(◐‿◑)

    2024-07-13 11:32:03       17 阅读
  3. C++ 基础练习 - 第一章(英文版)

    2024-07-13 11:32:03       18 阅读
  4. 深入解析BeautifulSoup:Python网页抓取的瑞士军刀

    2024-07-13 11:32:03       21 阅读
  5. Sentinel和hystric的运用详解

    2024-07-13 11:32:03       22 阅读
  6. 如何让代码添加的控件显示出来

    2024-07-13 11:32:03       19 阅读
  7. prompt第四讲-fewshot

    2024-07-13 11:32:03       20 阅读
  8. Netty Websocket SpringBoot Starter

    2024-07-13 11:32:03       23 阅读
  9. 第五十五章 生成的 WSDL 的详细信息 - types

    2024-07-13 11:32:03       22 阅读