Fork me on GitHub
摘要: Binary Tree Level Order Traversal 2 二叉树层序遍历 给一个二叉树的root,返回其节点值从低向上遍历,每一层从左到右 遍历。 Input: root = [3,9,20,null,null,15,7] Output: [[15,7],[9,20],[3]] /** 阅读全文
posted @ 2021-04-22 10:27 WilliamCui 阅读(80) 评论(0) 推荐(0)
摘要: Print Binary Tree Top to Bottom 从上到下打印二叉树 从上到下按层打印二叉树,一层从左到右打印。 思路 使用queue完成对树的层序遍历 /** * Definition for a binary tree node. * public class TreeNode { 阅读全文
posted @ 2021-04-22 10:24 WilliamCui 阅读(84) 评论(0) 推荐(0)