Problem Review Template

Use this after every problem — solved or failed. The review is where the learning compounds. Without it, problems are forgotten in 72 hours.

Save each review as a separate file or notebook entry. Recommended: reviews/YYYY-MM-DD-problem-name.md.


Template

# Problem Name

## Source
LeetCode 42 / Codeforces Round 800 Div 2 C / etc.

## Difficulty
Easy / Medium / Medium-Hard / Hard / Very Hard / CP-Hard / Grandmaster

## Pattern(s)
Two pointers / Sliding window / DP-2D / Graph BFS / etc.
(Multiple patterns possible.)

## First Intuition
What was my first instinct on reading the problem?
What pattern did I think it was?
Was that intuition right?

## Brute Force
- Approach (1–2 sentences)
- Complexity: time / space
- Why it doesn't pass (or "passes within constraints")

## Optimal Idea
- Approach (3–5 sentences)
- Key insight (the *one* thing that unlocks the problem)
- Complexity: time / space

## Why I Missed It (if applicable)
The honest answer. Choose from:
- Didn't recognize the pattern
- Recognized the pattern but applied it wrong
- Couldn't derive the recurrence / invariant
- Wrong data structure choice
- Implementation bug
- Misread the problem
- Ran out of time
- Got the optimal but couldn't prove it

## Key Insight
The single sentence that, if I'd known it, would have unlocked the problem in 5 minutes.

## Data Structures Used
- DS 1: why
- DS 2: why
- (etc.)

## Complexity
Time: O(...)
Space: O(...)
Tight bound? Y/N
Amortized? Y/N

## Bugs I Made
- Off-by-one at line X
- Forgot to handle empty case
- Wrong comparison operator (<= vs <)
- Used wrong variable in inner loop
- Modified collection while iterating
- (etc.)

## Edge Cases I Missed
- Empty input
- Single element
- All duplicates
- All negatives
- Max constraint
- Disconnected component
- (etc.)

## Follow-ups Practiced
- "What if the input is streamed?" → answer
- "What if N is 10^9?" → answer
- "What if memory is constrained?" → answer

## Product Extension
How does this map to a real-world system?
e.g., "This LRU cache pattern is exactly what a CDN edge node uses for hot-content eviction."

## Language/Runtime Notes
- Specific stdlib gotcha I hit
- Memory behavior surprise
- Concurrency consideration if relevant

## How I Would Recognize This Again
A pattern signal in plain English:
"When the problem asks for the minimum window covering K elements over a stream, with constant-time element insertion/removal and order matters, it's a sliding window with a hashmap."

This is the most important field. Optimize for *recognition*, not memorization.

## Re-solve Schedule
Per [SPACED_REPETITION.md](SPACED_REPETITION.md):
- Same day: ☐ done / not done
- 2 days later: ☐ scheduled for [date]
- 1 week later: ☐ scheduled for [date]
- 2 weeks later: ☐ scheduled for [date]
- 1 month later: ☐ scheduled for [date]
- 3 months later: ☐ scheduled for [date]

## Attempts Log
| Date | Unaided? | Time | Outcome | Notes |
|---|---|---|---|---|
| 2026-05-20 | N | 45 min | Wrong, then hint | Missed monotonic stack pattern |
| 2026-05-22 | Y | 18 min | Correct | Recognized pattern immediately |
| 2026-05-29 | Y | 12 min | Correct | Optimal first attempt |

How To Fill It Out (Do’s and Don’ts)

DO

  • Be brutally honest. “I gave up after 20 minutes” is more useful than “I solved it but slowly”.
  • Name the one insight. Forcing yourself to a single sentence forces understanding.
  • Re-solve from a blank file at scheduled intervals.
  • Tag heavily. Pattern, difficulty, data structure — these become your search keys.

DON’T

  • Copy the editorial verbatim. Translate into your own words.
  • Skip the “Why I Missed It” field when you got it right — what was hard about it? What might have tripped you up if you’d been less lucky?
  • Skip the “How I Would Recognize This Again” field. This is where 80% of the value lives.
  • Move on without scheduling the next re-solve.

Review Aggregation

Every Friday: skim the week’s reviews. Look for patterns:

  • “I keep missing monotonic stack opportunities” → drill that pattern.
  • “I keep making off-by-one bugs in binary search” → write a personal binary search template and use it.
  • “I keep choosing the wrong DP state on tree problems” → revisit phase-05-dp/categories/dp-tree.md.

Every month: aggregate into a personal weakness list. Top 3 weaknesses get dedicated drilling for the next month.