计算机组成原理
计算机网络
网络分层 + 端到端路径 TCP 精讲 HTTP 与 Web 体系
mysql 知识点
环境准备 基础查询 约束与范式基础 索引 + EXPLAIN 事务与并发控制 表设计与数据治理 运维与排障 体系架构 附录 docker-componse.yml ...
二叉树的右视图
二叉树的右视图 题目 思路 思路 1: 层序遍历,用队列做 BFS,最后出列的就是最右边。 ...
二叉搜索树中第 K 小的元素
题目 思路 思路一. 中序遍历,取第 K 个 思路二. 维护每个子树的大小 ...
酒馆新赛季
Jeef 阿凯最好换技能 养酒馆野猪人很强 鹦鹉必须拿 巨大的火车王很有用 巨大的狂战很有用 低本磁力不贴 二本磁力 + 豆哥额外 Combo 瑞文和点金一起发牌时要额外关注 有鹦鹉的情况下,可以给触发战吼野兽套盾
Docker 知识点
Redis 知识点
附录 缓存系统实战 缓存系统实战 application.properties: ...
二叉树的层序遍历
二叉树的层序遍历 题目 思路 put root into a queue queue is not empty 2.1. size = queue.size(), this is exactly how many nodes are in the current level. 2.1. repeat size times: * pop one node from queue * add its value to level * add left and right child Java 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 class Solution { public List<List<Integer>> levelOrder(TreeNode root) { List<List<Integer>> res = new ArrayList<>(); if (root == null) { return res; } Deque<TreeNode> q = new ArrayDeque<>(); q.offer(root); while(!q.isEmpty()) { int size = q.size(); List<Integer> level = new ArrayList<>(size); for (int i = 0; i < size; i ++) { TreeNode node = q.poll(); level.add(node.val); if (node.left != null) q.offer(node.left); if (node.right != null) q.offer(node.right); } res.add(level); } return res; } }
二叉树的直径
题目 Solution The longest path through that node equals: left subtree depth + right subtree depth. the longest path must pass through some node as a highest point. ...