安橙的博客

👋 欢迎来到我的博客

mysql 知识点

环境准备 基础查询 约束与范式基础 索引 + EXPLAIN 事务与并发控制 附录 docker-componse.yml ...

二月 12, 2026

二叉树的右视图

二叉树的右视图 题目 思路 思路 1: 层序遍历,用队列做 BFS,最后出列的就是最右边。 ...

二月 11, 2026

二叉搜索树中第 K 小的元素

题目 思路 思路一. 中序遍历,取第 K 个 思路二. 维护每个子树的大小 ...

二月 11, 2026

酒馆新赛季

Jeef 阿凯最好换技能 养酒馆野猪人很强 鹦鹉必须拿 巨大的火车王很有用 巨大的狂战很有用 低本磁力不贴 二本磁力 + 豆哥额外 Combo 瑞文和点金一起发牌时要额外关注 有鹦鹉的情况下,可以给触发战吼野兽套盾

二月 11, 2026

Docker 知识点

二月 6, 2026

Redis 知识点

附录 缓存系统实战 缓存系统实战 application.properties: ...

二月 6, 2026

二叉树的层序遍历

二叉树的层序遍历 题目 思路 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; } }

二月 6, 2026

二叉树的直径

题目 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. ...

二月 6, 2026

将有序数组转换为二叉搜索树

将有序数组转换为二叉搜索树 题目 思路 A height-balance BST is achieved by always picking the middle element as the root. The left and right subtree sizes differ by at most 1. ...

二月 6, 2026

验证二叉搜索树

验证二叉搜索树 题目 思路 root starts with (-inf, +inf) left child inherits (min, root.val) right child inherits (root.val, max) Java 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 class Solution { public boolean isValidBST(TreeNode root) { return dfs(root, Long.MIN_VALUE, Long.MAX_VALUE); } private boolean dfs(TreeNode node, long low, long high) { if (node == null) { return true; } long v = node.val; if (v <= low || v >= high) { return false; } return dfs(node.left, low, v) && dfs(node.right, v, high); } }

二月 6, 2026