识别信号
- Do you recognize that Two Sum only needs a complement existence check, not comparison against every later element?
- Can you explain why checking the hash map before inserting the current value avoids reusing the same index?
解题流程
- 1. 明确窗口/状态定义
- 2. 更新状态并维护约束
- 3. 用边界样例验证
常见失分点
- Inserting the current value before checking its complement can incorrectly pair an element with itself when the target is twice that value.