In-memory database
Asked at Anthropic · Coding Questions · Difficulty: Medium · Last asked May 10, 2026
Build a small in-memory database that stores records as `key -> field -> value`, in four levels. Level 1 stores and reads fields, Level 2 lists them in sorted order, Level 3 lets a field expire after a time-to-live, and Level 4 saves and restores the whole state. There is no real clock: every method receives the current time as a `timestamp` argument and must use only that.
Loading the problem…