摘要: 广度优先搜索+队列 class Solution { public List<Integer> rightSideView(TreeNode root) { List<Integer> list = new LinkedList<>(); if (root == null){ return list 阅读全文
posted @ 2021-12-23 15:07 振袖秋枫问红叶 阅读(31) 评论(0) 推荐(0)
摘要: 广度优先搜索+队列 class Solution { public List<List<Integer>> zigzagLevelOrder(TreeNode root) { List<List<Integer>> list = new LinkedList<>(); if (root == nul 阅读全文
posted @ 2021-12-23 11:44 振袖秋枫问红叶 阅读(36) 评论(0) 推荐(0)
摘要: 广度优先搜索 class Solution { public List<List<Integer>> levelOrderBottom(TreeNode root) { List<List<Integer>> list = new ArrayList<>(); if (root == null){ 阅读全文
posted @ 2021-12-23 11:10 振袖秋枫问红叶 阅读(24) 评论(0) 推荐(0)
摘要: 广度优先搜索+队列 import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Queue; class Solution { public List<List<In 阅读全文
posted @ 2021-12-23 10:55 振袖秋枫问红叶 阅读(35) 评论(0) 推荐(0)