摘要: 104. 二叉树的最大深度 首先是层序遍历 /** * Definition for a binary tree node. * function TreeNode(val, left, right) { * this.val = (val undefined ? 0 : val) * this.l 阅读全文
posted @ 2023-03-30 15:13 herbert_118 阅读(36) 评论(0) 推荐(0)
摘要: 102. 二叉树的层序遍历 题目链接:https://leetcode.cn/problems/binary-tree-level-order-traversal/ bfs,队列,记录下本层的数量和下一层的数量 /** * Definition for a binary tree node. * f 阅读全文
posted @ 2023-03-30 11:17 herbert_118 阅读(22) 评论(0) 推荐(0)