~/problems
Problems
Basics first, then the classics, then company-style assessments. Every problem has tests you run right here; multi-level ones unlock as you go. See the roadmap.
In-memory database
CRUD with fields, range scans, TTL expiry, time-travel reads.
Notes
Format: CodeSignal-style, 4 levels in about 90 minutes. Each level adds methods, and later tests use earlier ones.
Strategy
- Read all of level 1, code it plainly, and pass it fast. Speed on the early levels buys time for level 4.
- Plan for level 4 from the start: storing a history per field (a list of
(time, value, expires_at)) makes TTL and "value at time t" trivial. - One
_value_at(key, field, t)helper that everything calls keeps expiry logic in one place.
Gotchas: is expiry exclusive (t >= expires_at means gone)? Does a plain set clear the TTL? Do scans sort by field name?
5 problems
Practical systems
Stateful stores Key-value stores, file systems, banks, with history.
In-memory database
- Basics: records of fields in nested dicts basics easy
- Per-field undo in a record store easy
- OA: In-memory database 5 levels Anthropic medium
- In-memory table with SQL-style queries 6 levels OpenAI medium
- OA: Key-value store with nested transactions and rollback 2 levels py · c++ · java medium