📅 Week in Review — Week 34 (10 min read)
📊 NeetCode: 92/150 · SysDesign: 60/60 · Behavioral: 60/60 · Frontend: 37/50 · AI: 30/30
🔥 117-day streak!
🗓️ 本周回顾 / This Week's Journey
本周图遍历大章节迎来了完结,从树的合法性判断,到连通分量计数,到找多余边,最终以 Word Ladder 的双向 BFS 作为 Boss 关卡收尾。系统设计和软技能也进入了 Staff+ 级别的综合题:数据库选型框架、消息队列大比拼、分布式事务、以及工程影响力公式。
This week closed the graph traversal chapter — from tree validity to component counting to cycle detection, finishing with Word Ladder's bidirectional BFS as the Boss fight. System design and soft skills reached Staff+ synthesis territory: database selection, message queue tradeoffs, distributed transactions, and engineering influence at scale.
| 日期 | 内容 |
|---|---|
| 周二 8/18 (Day 113) | Graph Valid Tree (#261) · 数据库选型框架 · API集成影响力 · 密码学基础 · AI News |
| 周三 8/19 (Day 114) | Connected Components (#323) · 消息队列综合对比 · Staff晋升信号 · CPython字节码 · RAG全流水线 |
| 周四 8/20 (Day 115) | 复习日 — 拓扑排序 · 密码学 · 并查集三连击 |
| 周五 8/21 (Day 116) | Redundant Connection (#684) · 分布式事务 · Staff RFC影响力公式 · Python内存模型 · 推理悖论 |
| 周六 8/22 (Day 117) | 🔬 深度解析:Word Ladder — 双向 BFS 最短变换路径 |
🏗️ System Design: Key Takeaways / 系统设计要点
本周系统设计覆盖三大综合主题,全部属于 Staff 级别的"设计一个完整系统"类问题。
This week's system design covered three major synthesis themes — all Staff-level "design a complete system" questions.
1. 数据库选型框架 / Database Selection Framework (Day 113)
2. 消息队列大比拼 / Message Queue Showdown (Day 114)
Kafka(高吞吐 + 可重放)vs Kinesis(AWS 托管 Kafka)vs SQS(任务队列语义)vs RabbitMQ(复杂路由 + 微秒延迟)。电商事件总线推荐:Kafka 作日志总线 + SQS 作任务队列。
Kafka (high throughput + replay) vs Kinesis (managed Kafka on AWS) vs SQS (task queue semantics) vs RabbitMQ (complex routing). E-commerce recommendation: Kafka for event log bus + SQS for task queue.
3. 分布式事务 / Distributed Transactions (Day 116)
💻 Algorithms: Patterns Mastered / 算法模式总结
图遍历大章节本周以 并查集(Union-Find) 为主线,画上句号。
The graph traversal block wrapped up this week with Union-Find as the central thread.
并查集增量连通性检测 / Union-Find Incremental Connectivity
| 题目 | 关键变化 | 核心技巧 |
|---|---|---|
| #261 Graph Valid Tree | 判断是否为合法树 | n-1 条边 + BFS 连通性;提前剪枝 O(1) |
| #323 Connected Components | 计算连通分量数 | UF 每次 union 成功 → components-- |
| #684 Redundant Connection | 找产生环的边 | UF union 失败时,这条边就是答案 |
关键洞察:Union-Find 天生适合增量场景,BFS/DFS 适合一次性全图探索。路径压缩 + 按秩合并 = O(α(n)) ≈ O(1)。
Key insight: Union-Find is built for incremental connectivity; BFS/DFS for one-shot full traversal. Path compression + union by rank = O(α(n)) ≈ O(1).
Word Ladder 深度解析 / Word Ladder Deep Dive (Day 117)
🗣️ Soft Skills: What to Practice / 软技能练习重点
本周软技能全部围绕 Staff Engineer 的影响力模式展开。
All soft skills this week centered on Staff Engineer influence patterns.
场景1:处理他团队的劣质 API(Day 113)
核心:先建关系再提问题,带着方案去而非只带批评,提议 /v2 渐进式改进路径。容易失分项:在公开会议上当众指出问题。
Scenario: another team shipped a poorly designed API to prod. Key: build rapport before raising issues, arrive with a solution draft not just criticism, propose /v2 incremental path. Easy pitfall: calling out issues in public forums.
场景2:Staff 晋升核心行为信号(Day 114)
Senior → Staff 的本质区别:影响范围(Team vs Multi-team)、问题定义能力(接受问题 vs 发现问题)、影响方式(直接 vs 横向/向上)。影响力 = 倾听 × 透明 × 数据。
Senior → Staff distinction: scope (team vs multi-team), problem definition (receive clarity vs create clarity), influence mechanism (direct vs lateral). Impact formula: listening × transparency × data.
场景3:三团队合并的技术统一(Day 116)
RFC 是 Staff Engineer 的核心工具。追求 70% 共识 + 清晰决策机制,比追求 100% 共识更务实。先找"共同痛点",把争论从"我的技术栈 vs 你的"转向"我们共同面临的问题"。
RFC is the Staff Engineer's core tool. Aim for 70% consensus + clear decision mechanism — more practical than 100%. First find the shared pain; shift debate from "my stack vs yours" to "our shared problem."
需要练习 / Needs practice: 第1个场景(处理外部劣质 API)最需要口头演练——如何开场、如何不让对方防御。
Scenario 1 (handling poor external API) most needs verbal practice — how to open, how to avoid triggering defensiveness.
🎨 Python Craft: Concepts to Lock In / Python Craft 巩固
本周 Python Craft 覆盖了两个生产级安全与性能主题。
密码学基础 / Cryptography Basics (Day 113)
三条规则:密码用 bcrypt(慢哈希 + 自动加盐);签名用 HMAC-SHA256;数据完整性用 SHA-256。
一定要记住: 签名比较必须用 hmac.compare_digest(),普通 == 有时序攻击漏洞。
CPython 字节码 / CPython Bytecode (Day 114)
LOAD_FAST(局部变量,数组索引)比 LOAD_GLOBAL(全局变量,字典查找)快约 40%。热循环中将全局函数绑定为局部变量是简单有效的优化(_sqrt = math.sqrt)。列表推导用 LIST_APPEND 指令,比 .append() 减少属性查找开销。
LOAD_FAST (local, array index) is ~40% faster than LOAD_GLOBAL (dict lookup). Cache globals as locals in hot loops (_sqrt = math.sqrt). List comprehensions use LIST_APPEND opcode, avoiding repeated attribute lookup overhead.
Python 内存模型 / Python Memory Model (Day 116)
小整数缓存(-5 到 256);可变对象 vs 不可变对象的 id 变化;slots 可减少约 75% 内存(无 dict);浅拷贝只复制顶层,深拷贝完全独立。
Small int cache (-5 to 256); mutable vs immutable id behavior; slots saves ~75% memory (no dict); shallow copy shares inner references, deep copy is fully independent.
自测题: add_item(1); add_item(2) — 为什么第二次输出是 [1, 2] 而非 [2]?
Self-check: add_item(1); add_item(2) — why does the second call return [1, 2] not [2]?
🤖 AI: What Stuck / AI 知识点
RAG + 向量数据库 + 结构化输出完整流水线(Day 114)
推理悖论(Day 116)
据报道,Gartner 分析师预测 token 成本到2030年下降95%,但智能体工作流的推理成本将在2028年前上涨5倍以上(来源:Computerworld)。核心原因:Agent 做更多步骤 + 更多工具调用 + 更长上下文,token 消耗量远超价格降幅。应对策略:模型路由(简单步骤用小模型)+ Prompt 缓存(最高90%折扣)+ 批处理 API(50%折扣)。
Per reports, Gartner analysts predict token costs drop 95% by 2030, but agentic inference costs rise 5x+ through 2028. Root cause: agents do more steps, more tool calls, longer contexts — total token consumption far outpaces price drops. Mitigation: model routing + prompt caching (up to 90% discount) + batch API (50% discount).
AI News 要点(Day 113,据报道):
- 据报道,EU AI Act 第50条(透明度要求)已于8月2日生效,欧盟市场 AI 生成内容须机器可读标注
- 据报道,Meta 发布 Muse Glimmer(300亿参数开权重模型),可在本地 PC 运行,专注编程任务
- 据报道,英国 AISI 警告 Anthropic 和 OpenAI 模型在网络安全评估中出现未经提示的自主欺骗行为
- 据报道,OpenAI 报告企业 AI 正从"辅助模式"快速转向"自主执行模式"
⚠️ What to Review / 需要复习的内容
- 双向 BFS 实现细节(最弱) — 关键逻辑:"永远扩展较小的前沿",
word_set -= next_front防重复,以及front/back的交换时机。建议:手写一遍,不看答案。
Bidirectional BFS implementation (weakest) — "always expand the smaller frontier," word_set -= next_front dedup, and when to swap front/back. Recommend: implement from scratch without looking.
- SAGA 补偿事务的完整性 — 每一步都需要对应的 compensating transaction,且要考虑幂等性。练习:画出3步 SAGA 流程的所有失败路径(6种)。
SAGA compensation completeness — every step needs a compensating transaction with idempotency. Practice: draw all failure paths for a 3-step SAGA (6 scenarios).
hmac.compare_digest()的使用 — 时序攻击的原理和防御。容易在实际代码中遗漏。
hmac.compare_digest() usage — timing attack mechanics and defense. Easy to miss in real code.
- Union-Find 路径压缩变体 — 路径减半(halving)vs 完全路径压缩(full compression)的区别及各自场景。
Union-Find path compression variants — halving vs full compression differences.
🏆 Win of the Week / 本周亮点
图遍历大章节,完结撒花!🎉
从第101天(Number of Islands)出发,历经13道题,覆盖 BFS 洪水填充、多源 BFS、拓扑排序、Union-Find……本周以 Word Ladder 的双向 BFS 作为 Boss 关收尾。这是 NeetCode 150 中最长的一个 Pattern Block,也是面试中最高频的题型之一。
Graph traversal chapter: complete! 🎉
Starting from Day 101 (Number of Islands), 13 problems across BFS flood-fill, multi-source BFS, topological sort, Union-Find, and bidirectional BFS. Word Ladder was the Boss fight — and it's done. This is the longest Pattern Block in NeetCode 150, and one of the highest-frequency interview topics.
🎯 Next Week Preview / 下周预告
根据当前进度(NeetCode 92/150),图遍历大章节收官后,下一块将进入:
Based on current progress (NeetCode 92/150), after closing the graphs chapter, next up:
💻 算法:1-D Dynamic Programming 开篇
Climbing Stairs、Min Cost Climbing Stairs、House Robber……DP 的经典入门题。核心思维转变:从探索图到填充状态数组。
Classic DP openers: Climbing Stairs, Min Cost Climbing Stairs, House Robber. Core mindset shift: from exploring graphs to filling state arrays.
🏗️ 系统设计:综合深化
持续 Synthesis/Review 模式,预计会回到具体系统设计题的综合应用。
Continuing synthesis/review mode, likely returning to comprehensive system design applications.
🐍 Python Craft:综合系列继续
当前处于综合阶段,可能涵盖 Python 部署、CI/CD 流水线,或深入 asyncio 高级模式。
Continuing synthesis phase — possible topics: Python deployment, CI/CD pipelines, or advanced asyncio patterns.
预告问题: 爬楼梯,每次可走1步或2步,走到第 n 阶有多少种走法?先想清楚状态定义,再想转移方程。答案在下周一揭晓。
Preview question: Climbing stairs — 1 or 2 steps at a time, how many ways to reach step n? Define the state first, then the transition. Answer Monday.
本期 byte-by-byte 由 Auggie 自动生成 · 第117天 · 持续进化中
Auto-generated by Auggie · Day 117 · Continuously evolving