Archive
Archive
Browse past posts by year and month.
2026-07
2026-06
- Jun 25, 2026
[Leetcode 986] 区间列表的交集
给定两个有序且内部不重叠的区间列表,要求返回这两个区间列表的所有交集。
#区间#双指针 - Jun 18, 2026
[Leetcode 1813] 句子相似性 III
给定两个英文句子,判断能否通过在其中一个句子的任意位置插入一段句子,使两个句子变得完全相同。
#双指针#队列 - Jun 18, 2026
[Leetcode 737] 句子相似性 II
给定两个句子和一组有具有传递性的相似词对,判断两个句子是否相似。
#并查集#DFS#BFS - Jun 18, 2026
[Leetcode 734] 句子相似性
给定两个句子 sentence1、sentence2,以及一组相似单词对 similarPairs,判断两个句子是否相似。
#哈希 - Jun 18, 2026
[Leetcode 772] 基础计算器 III
给定一个合法表达式字符串,包含非负整数、+ - * /、空格以及括号 (、),计算表达式结果。
#字符串#栈#递归 - Jun 18, 2026
[Leetcode 251] 展开二维向量
给定一个二维数组 vec,实现一个迭代器,支持next 和 hasNext 两种操作。
#矩阵#双指针#设计#迭代 - Jun 18, 2026
[Leetcode 227] 基础计算器 II
给定一个只包含非负整数、空格,以及 + - * / 的字符串表达式,计算它的值。
#栈 - Jun 18, 2026
[Leetcode152] 最大乘积子数组
给定整数数组 nums,返回乘积最大的非空连续子数组的乘积。
#动态规划 - Jun 18, 2026
[Leetcode 140]单词拆分 II
给定字符串 s 和词典 wordDict,返回所有能把 s 拆成词典单词的句子。
#DFS#回溯#动态规划#Tries - Jun 18, 2026
[Leetcode 729] 日程安排 1
实现一个日历类,支持 book(start, end)。如果新事件和已有事件没有重叠,则插入并返回 True;否则不插入,返回 False。
#数组#二分搜索 - Jun 16, 2026
[Leetcode 1169] 无效交易
给定一组交易记录,两条无效规则:金额超过 1000,或者同一个人在 60 分钟内在不同城市发生交易。找出所有无效交易。
#哈希#字符串#数组#迭代 - Jun 12, 2026
[Leetcode 398] 随机数索引
给定一个可能含有 重复元素 的整数数组 nums。随机等概率地输出一个值等于 target 的索引。
#哈希#概率#水塘抽样 - Jun 12, 2026
[Leetcode 403] 青蛙过河
给定递增数组 stones 表示石子位置,青蛙能否在「下一跳距离与上一跳之差不超过 1」的约束下,从第一块石子跳到最后一块石子。
#动态规划#DFS#哈希 - Jun 12, 2026
[Leetcode 39] 组合和
给定无重复正整数数组 candidates,每个数可重复使用,返回所有和为 target 的不重复组合。
#回溯#DFS - Jun 12, 2026
[Leetcode 55] 跳跃游戏
给定数组 nums,nums[i] 表示从位置 i 最多可以往右跳多少步。从0 出发,能不能到达n-1。
#贪心#动态规划 - Jun 12, 2026
[Leetcode 473] 火柴拼正方形
能不能用一组长度不一样的火柴拼成一个正方形。
#回溯#DFS - Jun 12, 2026
[Leetcode 33] 搜索旋转排序数组
在旋转后的数组中找到target的index
#二分搜索 - Jun 12, 2026
[Leetcode 560] 和为 K 的子数组
统计整数数组 nums 中有多少个连续子数组的元素和正好等于 k
#Prefix#哈希 - Jun 12, 2026
[Leetcode 300] 最长递增子序列
最长严格递增 子序列的长度
#二分搜索#动态规划#贪心 - Jun 12, 2026
[Leetcode 72] 编辑距离
word1 转换成 word2 所需的最少操作数
#动态规划 - Jun 9, 2026
Production Agents Need Workflow Graphs
The production abstraction for AI is not a “smarter agent loop.” It is a stateful execution graph: a system organized around explicit state transitions, dependency-aware scheduling, versioned plans, deterministic control boundaries, and carefully managed side effects. Intelligence alone is insufficient. Production reliability emerges from how execution, authority, recovery, and state mutation are structured across the graph.
#AI Agent#Production AI#System Design
2026-05
- May 26, 2026
Building Auditable LLM Workflows for Medical Coding
Medical coding is a high-stakes extraction and verification problem, not a simple text generation task. Asking an LLM to read a long clinical note and directly output ICD codes risks hallucinated mappings, missed comorbidities, and results that are difficult for human coders to audit. A reliable medical coding system may benefit from an LLM-assisted workflow: extract clinical evidence, retrieve candidate codes, verify mappings, validate against the taxonomy, and route uncertainty to human review. The model should not be expected to memorize every code. Its job is to help produce auditable evidence inside a controlled workflow.
#Applied AI#NLP#System Design - May 2, 2026
The Runtime Behind Production AI
A layered framework for scaling production AI systems begins with the SLA: latency, throughput, reliability, cost per resolved task, fallback behavior, and quality targets. Those requirements drive the architecture of the runtime — spanning the edge gateway, safety and governance, orchestration and routing, inference serving, compute scheduling, context and state management, model lifecycle operations, and observability.
#AI Agent#Production AI#AI Infra#System Design
2026-04
2026-03
2026-02
- Feb 20, 2026
Design Agents Around Workflows, Not Chat Turns
Chat is a useful interface, but it becomes a weak system design primitive once agents are expected to complete real work. A reliable agent should advance a process, not merely generate text. That requires routing simple requests to deterministic paths, using retrieval when grounding is needed, reserving reasoning for ambiguous tasks, and separating planning from execution. For repeatable workflows, LLMs can generate structured plans while deterministic engines handle tool calls, retries, and state transitions. Production agents should be designed around explicit, inspectable, and evaluable workflow state—not reconstructed from chat history every time.
#AI Agent#Production AI#System Design - Feb 9, 2026
Routing Before Reasoning
Production agents should not send every request to the most expensive reasoning path. As reasoning models become more capable, they also introduce new production risks: higher latency, unpredictable cost, KV-cache pressure, and unnecessary “overthinking” for simple requests. Before invoking deep inference, tool use, or multi-step planning, a production agent should first decide which path is actually needed. Production agents are control systems. The real engineering value is not only in the model, but in the controller that decides when to reason, when to execute, and when to ask for human approval.
#AI Agent#Production AI#System Design - Feb 7, 2026
[Leetcode 204] 质数计数
给定整数 n ,返回 所有小于非负整数 n 的质数的数量 。
#数学#数组 - Feb 7, 2026
[Leetcode 206] 反转链表
反转整个单链表
#链表#双指针#递归 - Feb 7, 2026
[Leetcode 236] 二叉树的最近公共祖先
给定一个二叉树, 找到该树中两个指定节点的最近公共祖先。
#二叉树#DFS#BFS - Feb 7, 2026
[Leetcode 179] 最大数
重新排列数组中每个数的顺序,组成最大的整数。
#字符串#排序#贪心 - Feb 7, 2026
[Leetcode 239] 滑动窗口最大值
大小为 k 的滑动窗口从数组的最左侧移动到数组的最右侧,返回 滑动窗口中的最大值 。
#滑动窗口#堆#单调队列 - Feb 7, 2026
[Leetcode 208] 实现 Trie
实现 Trie 类:初始化、插入字符串 、检索、前缀检索
#设计#数据结构#Tries#哈希 - Feb 7, 2026
[Leetcode 84] 柱状图中最大的矩形
柱状图能够勾勒出来的矩形的最大面积。
#单调栈 - Feb 7, 2026
[Leetcode 121] 买卖股票的最佳时机
一次买卖的最大利润
#贪心#滑动窗口 - Feb 7, 2026
[Leetcode 126] 单词接龙 II
所有从beginWord转化到endWord的最短转换序列
#BFS#DFS#回溯 - Feb 7, 2026
[Leetcode 200] 岛屿数量
网格中被水(0)包围的岛屿的数量
#DFS#BFS#并查集 - Feb 7, 2026
[Leetcode 79] 单词搜索
word 是否存在于字母网格中
#回溯 - Feb 7, 2026
[Leetcode 105] 从前序与中序遍历序列构造二叉树
给定二叉树的preorder 和 inorder 数组,构造出二叉树并返回其根节点。
#分治#递归#哈希 - Feb 7, 2026
[Leetcode 122] 买卖股票的最好时间 II
可进行无限次交易的最大利润
#动态规划#贪心 - Feb 7, 2026
[Leetcode 88] 合并两个有序数组
合并两个按非递减顺序排列的整数数组
#双指针 - Feb 7, 2026
[Leetcode 138] 随机链表的复制
深拷贝带随机指针的链表
#链表 - Feb 7, 2026
[Leetcode 143] 重排链表
按 L0 → Ln → L1 → Ln-1 → ... 的顺序重新连接链表
#链表#双指针 - Feb 7, 2026
[Leetcode 171] Excel 列名转换为数字
将 Excel 列名称转换为对应的列号。
#字符串 - Feb 7, 2026
[Leetcode 62] 不同路径
位于网格左上角的机器人总共有多少条不同的路径达到网格的右下角
#动态规划 - Feb 7, 2026
[Leetcode 92] 反转链表II
反转从位置left到位置right之间的链表节点
#链表 - Feb 7, 2026
[Leetcode 128] 最长连续序列
数组中最长连续整数序列的长度
#并查集#哈希 - Feb 7, 2026
[Leetcode 83] 删除排序链表中的重复元素
删除已排序的链表中所有重复的元素
#双指针#递归 - Feb 7, 2026
[Leetcode 102] 二叉树的层序遍历
逐层地,从左到右访问二叉树的所有节点
#二叉树#DFS#BFS - Feb 7, 2026
[Leetcode 116] 填充每个节点的下一个右侧节点指针
给 完美二叉树 的所有节点填充一个指向右侧节点的next指针
#二叉树#BFS - Feb 7, 2026
[Leetcode 123] 买卖股票的最佳时机 III
最多进行两次交易的最大利润
#动态规划 - Feb 7, 2026
[Leetcode 101] 对称二叉树
给定一个二叉树的根节点root,检查它是否轴对称。
#二叉树#DFS#BFS - Feb 7, 2026
[Leetcode 160] 相交链表
找出两个链表的相交的起始节点。
#链表#双指针 - Feb 7, 2026
Breadth-First Search: Level-Order Exploration
#Tree#Graph#BFS#Dijkstra - Feb 7, 2026
Depth-First Search: Exploring Deep Before Wide
#DFS#Tree#Graph#Recursion - Feb 7, 2026
[Leetcode 11] 盛最多水的容器
找出数组 height中的两条线,使得它们与 x 轴共同构成的容器可以容纳最多的水。
#双指针 - Feb 7, 2026
[Leetcode 25] K 个一组翻转链表
每 k 个节点一组进行翻转,返回修改后的链表。
#双指针#链表 - Feb 7, 2026
[Leetcode 4] 两个排序数组的中位数
找出并返回这两个升序数组的中位数 。
#二分搜索 - Feb 7, 2026
[Leetcode 5] 最长回文子串
找字符串 s 中最长的回文子串。
#双指针#动态规划 - Feb 7, 2026
[Leetcode 32] 最长有效括号
找出最长有效(格式正确且连续)括号子串的长度
#字符串 - Feb 7, 2026
[Leetcode 3] 无重复字符的最长子串
找出其中不含有重复字符的 最长子串的长度。
#双指针#字符串#滑动窗口 - Feb 7, 2026
[Leetcode 17] 电话号码的字母组合
字符串能表示的所有字母组合
#回溯#BFS#DFS - Feb 7, 2026
[Leetcode 34] 在排序数组中查找元素的第一个和最后一个位置
找出给定目标值在排序数组中的开始位置和结束位置。
#二分搜索 - Feb 7, 2026
[Leetcode 14] 最长公共前缀
查找字符串数组中的最长公共前缀。
#字符串 - Feb 7, 2026
[Leetcode 18] 四数之和
返回满足条件且不重复的四元组 [nums[a], nums[b], nums[c], nums[d]]
#双指针#排序 - Feb 7, 2026
[Leetcode 23] 合并 K 个升序链表
将所有升序链表合并到一个升序链表中
#链表#分治 - Feb 7, 2026
[Leetcode 19] 删除链表的倒数第 N 个节点
删除链表的倒数第 n 个节点
#双指针#链表 - Feb 7, 2026
[Leetcode 21] 合并两个有序链表
将两个升序链表合并为一个新的升序链表并返回
#链表 - Feb 7, 2026
[Leetcode 44] 通配符匹配
匹配字符串 (s) 和字符模式 (p), 支持 '?' 和 '*'
#字符串#动态规划#双指针#贪心 - Feb 7, 2026
[Leetcode 20] 有效的括号
判断括号字符串是否有效。
#字符串#栈 - Feb 7, 2026
[Leetcode 42] 接雨水
n 个柱子,下雨之后能接多少雨水。
#双指针#动态规划#单调栈 - Feb 7, 2026
Solving Problems with the Two-Pointers Technique
The two-pointer technique is essential for optimizing operations on arrays, strings, and lists, often reducing time complexity from O(n²) to O(n). Common patterns include opposing pointers, sliding windows, fast–slow pointers, and dual-input pointers—each suited to different problem types such as finding pairs, subarrays, or merging sorted lists.
#TwoPointers#SlidingWindow - Feb 7, 2026
Implementing Efficient Prefix Search with Tries
Prefix search is a fundamental operation in computer science, typically implemented using a Trie (prefix tree). A Trie is a dynamic data structure for storing a collection of strings, supporting efficient insertion, lookup, and enumeration operations. Tries and their variants provide a powerful and efficient way to manage and query large volumes of string data.
#数据结构#Tree#Recursion#Tries - Feb 7, 2026
Shrinking the Search Space with Binary Search
Binary search is an efficient searching technique based on the divide-and-conquer principle. By repeatedly narrowing the search space, it guarantees a worst-case time complexity of O(log n). It is well-suited for sorted data, monotonic arrays, and optimization problems where the goal is to find the best value. Common use cases include exact matching, boundary and insertion point searches, finding the closest element, and performing binary search on the answer space.
#BinarySearch#Search - Feb 7, 2026
Topological Sorting Explained: Sorting Dependency Chains
#Topological Sort#Graph - Feb 7, 2026
Understanding Recursion: Functions That Call Themselves
Recursion is a core computational concept where a problem is solved by calling itself on smaller instances. Recursion is key to many algorithms: DFS (Depth-First Search) is often implemented recursively, Dynamic Programming is fundamentally recursion with caching (memoization), and Divide & Conquer uses recursion to split problems into independent subproblems.
#Recursion#DFS#Dynamic Programming#Divide & Conquer - Feb 7, 2026
[Leetcode148] 链表排序
给出链表的头结点 head ,请将其按 升序 排列并返回 排序后的链表 。
#链表#排序#分治 - Feb 7, 2026
[Leetcode 46] 全排列
给定一个不含重复数字的数组 nums,返回其所有可能的全排列 。
#回溯 - Feb 7, 2026
[Leetcode 124] 二叉树中的最大路径和
二叉树中任意两节点之间路径的最大和,,路径不要求经过根节点。
#二叉树#DFS - Feb 7, 2026
[Leetcode 146] LRU 缓存
设计并实现 LRU 缓存,get 和 put 必须O(1) 时间
#哈希#链表#数据结构#设计 - Feb 7, 2026
[Leetcode 240] 搜索二维矩阵 II
搜索 m x n 的排序矩阵中的一个目标值 target 。
#搜索#矩阵#二分搜索 - Feb 3, 2026
从传统摘要到语义合成
在大语言模型(LLM)驱动的范式下,“摘要”已不再只是面向人类读者的短文本生成任务,而是逐渐演变为机器对机器(M2M)的语义合成算子。它的核心不只是压缩文本长度,而是建立一套从非结构化文本到结构化中间表示(IR)的编译机制,将原始材料转化为可消费、可检索、可追溯、可验证、可执行的高密度语义资产。要落地这一合成管线,系统必须依托上下文工程(Context Engineering)进行全生命周期治理:决定哪些信息可以进入,哪些信息需要保留,如何压缩、组织、呈现,以及如何评估其质量。
#AI#NLP#LLM#RAG
2026-01
- Jan 25, 2026
The Production Agent Stack
A reliable agent is not just an LLM connected to tools. A production agent stack is a system of layered responsibilities. The runtime owns execution state and governs workflow progression. The planner proposes next steps, but proposals are not execution. Memory provides contextual recall without serving as the source of truth. Agent interoperability enables structured delegation, while tools expose external capabilities through standardized protocols such as MCP. Validation transforms probabilistic model outputs into structured, policy-constrained proposals that can safely enter the execution pipeline. Execution itself occurs inside isolated runtime environments where side effects can be controlled, audited, recovered, or rolled back.
#AI Agent#Production AI#System Design - Jan 16, 2026
Building a Simple Invoice-processing Agent
This post walks through the implementation of a minimal invoice-processing agent. The agent parses an invoice, verifies it against a ledger, requests approval when needed, and writes the final entry only after validation. The core pattern is simple: state constrains actions, the planner proposes one, validation gates it, tools return observations, the reducer updates state, and the runtime decides whether to stop. Before adopting complex orchestration frameworks, build this loop first.
#AI Agent#Applied AI#System Design#ML coding
2025-12
2025-11
- Nov 19, 2025
Demystifying Agentic Search Engines
Agentic search engines—such as Google AI Mode, Perplexity, Bing Copilot, ChatGPT Search no longer means “type keywords, get ten blue links.” AI Search experience capable of understanding tasks, planning queries, calling tools, and synthesizing results and deliver a conversational response with inline citations, minimizing user effort. In this post, I’ll walk through the stack from bottom to top, how it crawls and indexes pages, how it retrieves and ranks information, and how recent features like RAG and Agentic search build upon these foundations.
#System Design#RAG#Retrieval#LLM - Nov 1, 2025
Modern Recommendation System Infrastructure
Building Modern Recommendation Systems introduces a comprehensive, end-to-end pipeline that drives intelligent recommendations. The post walks through the full machine learning workflow — from raw data preparation and feature engineering to model training, deployment, real-time inference, and system monitoring.
#System Design#RecSys#Recommendation#ML system
2025-10
2025-08
2025-07
2025-06
2025-02
2025-01
2024-11
2024-10
2024-09
2024-06
2024-05
- May 29, 2024
Retrieval-Augmented Generation (RAG)
Retrieval-Augmented Generation (RAG) combines large language models with external knowledge retrieval to produce more accurate and grounded responses. The post explains why RAG was introduced, explores its key use cases and real-world applications, and discusses challenges and considerations that impact performance in practical deployments.
#LLM#AI#GenAI#NLP - May 14, 2024
Essential Loss Functions for Machine Learning
#ML coding#ML