22/41
Part 4 of 7 · VersionsLearn
A snapshot only adds 1 to a counter
The practice problem's last level adds snapshots. snapshot() saves the store as it stands and returns a number, and a read names that number. Snapshot Array, on OpenAI's tag list (1 source), is this level with array positions for keys and no times.
The obvious version copies every key at each snapshot. That's O(k) time and memory per snapshot for k keys, even when only one key changed since the last one.
set 30, snapshot, set 45, set 60, snapshot, snapshot, set 90. What does snapshot 1 read?
Pick an answer above to see the rest