Code RoomMulti-version key-value store
HardPrep Room Coding #219

Multi-version key-value store

CodingStorage & CDNSenior–Staff~35 min

Implement a multi-version key-value store with point-in-time reads (MVCC). A logical clock starts at 0 and increments by 1 on every "put". Process operations: ["put", key, value] writes value to key at the new timestamp (the clock after incrementing); ["get", key, ts] reads the value key had AS OF timestamp ts, i.e. the value of the most recent put to that key whose timestamp is <= ts, or the string "<none>" if the key had no put at or before ts. Return a list with the result of each "get" op in order. The first put happens at timestamp 1. Keys/values are strings; <= 10^5 ops.

Implement
mvcc_store(ops: list[list]) → list[str]
Examples
in[[["put","a","v1"],["put","a","v2"],["get","a",1],["get","a",2]]]out["v1","v2"]
What a strong answer looks like

State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.

0:00 of about 35 min
InputExpectedGot
[[["put","a","v1"],["put","a","v2"],["get","a",1],["get","a",2]]]["v1","v2"]not run yetsample