Question
Implement a versioned key-value store with copy-on-write snapshots. Operations: ["put", key, value] writes to the live (current) version; ["snapshot"] freezes the current state and returns a snapshot id (0 for the first snapshot, 1 for the second, ...) — later writes must NOT affect already-taken snapshots; ["get", snapshot_id, key] reads key from the state as it was at that snapshot (-1 if the key was absent there); ["getlive", key] reads from the current live state (-1 if absent). Return a list with one entry per get and getlive operation, in order (snapshot operations are not added to the result list). Keys are strings, values are integers.
cow_store(ops: list[list]) → list[int][[["put","a",1],["snapshot"],["put","a",2],["get",0,"a"],["getlive","a"]]]out[1,2]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.
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.