摘要: 题目 链接:https://leetcode-cn.com/problems/binary-tree-level-order-traversal 给你一个二叉树,请你返回其按 层序遍历 得到的节点值。 (即逐层地,从左到右访问所有节点)。 示例: 二叉树:[3,9,20,null,null,15,7 阅读全文
posted @ 2020-10-31 20:04 消灭猕猴桃 阅读(63) 评论(0) 推荐(0) 编辑
摘要: 题目 https://leetcode-cn.com/problems/n-ary-tree-postorder-traversal/ 给定一个 N 叉树,返回其节点值的后序遍历。 例如,给定一个 3叉树 : 返回其后序遍历: [5,6,3,2,4,1]. 递归 class Solution { L 阅读全文
posted @ 2020-10-31 19:45 消灭猕猴桃 阅读(67) 评论(0) 推荐(0) 编辑
摘要: 题目 https://leetcode-cn.com/problems/n-ary-tree-preorder-traversal/ 给定一个 N 叉树,返回其节点值的前序遍历。 例如,给定一个 3叉树 : 返回其前序遍历: [1,3,5,6,2,4]。 递归 class Solution { Li 阅读全文
posted @ 2020-10-31 19:32 消灭猕猴桃 阅读(81) 评论(0) 推荐(0) 编辑
摘要: 题目 链接:https://leetcode-cn.com/problems/binary-tree-postorder-traversal 给定一个二叉树,返回它的 后序 遍历。 示例: 输入: [1,null,2,3] 1 \ 2 / 3 输出: [3,2,1] 递归 class Solutio 阅读全文
posted @ 2020-10-31 19:12 消灭猕猴桃 阅读(44) 评论(0) 推荐(0) 编辑
摘要: 题目 链接:https://leetcode-cn.com/problems/binary-tree-inorder-traversal 给定一个二叉树,返回它的中序 遍历。 示例: 输入: [1,null,2,3] 1 \ 2 / 3 输出: [1,3,2] 递归 class Solution { 阅读全文
posted @ 2020-10-31 18:33 消灭猕猴桃 阅读(49) 评论(0) 推荐(0) 编辑
摘要: 题目 链接:https://leetcode-cn.com/problems/insert-delete-getrandom-o1-duplicates-allowed 设计一个支持在平均 时间复杂度 O(1) 下, 执行以下操作的数据结构。 注意: 允许出现重复元素。 insert(val):向集 阅读全文
posted @ 2020-10-31 09:42 消灭猕猴桃 阅读(100) 评论(0) 推荐(0) 编辑