Back to problems

Design (key, value) Storage with Snapshots

Object-Oriented Programming · Apple · Medium

Create a key-value store that can preserve and read earlier point-in-time states. Implement the SnapshotMap class: SnapshotMap() Creates an empty store, with 0 assigned to the next snapshot. void put(String key, String value) Records value for key in the current live state. String get(String key) Looks up key in the live state and returns "" when the key has never been assigned. int snapshot() Captures the current state and returns the id assigned to that snapshot. Snapshot…

Checking your access…