Code Room
CodingHardcod-g1130
Subject MvccLevel Mid–Senior~30 minCommon in Algorithms & data structures interviewsIndustries Software development, Technology

Question

Implement an MVCC visibility check under snapshot isolation. versions is a list of [key, value, committed_at] — committed row versions, each stamped with the commit timestamp. A reading transaction has a snapshot timestamp 'snap': it sees, for each key, the version with the GREATEST committed_at that is strictly less than or equal to snap. queries is a list of keys to read. Return a list of [key, value] for each query in order, using the visible version; if no version is visible for a key, use the value 'MISSING'. Assume committed_at values for a key are distinct.

Implement
mvcc_read(versions: list[list], snap: int, queries: list[str]) → list[list]
Examples
in[[["x","v1",10],["x","v2",20]],15,["x"]]out[["x","v1"]]
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.

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.

Run or narrate your approach, then ask the coach.