Question
Implement MVCC snapshot visibility for a single row. The row has multiple versions, each given as [version_id, created_ts, deleted_ts] where created_ts is when the version became live and deleted_ts is when it was superseded (use -1 for a version that is still live). A reader with snapshot timestamp `snap_ts` sees a version if created_ts <= snap_ts AND (deleted_ts == -1 OR deleted_ts > snap_ts). At most one version is visible at any snapshot. Return the version_id of the visible version, or -1 if none is visible. Versions are not pre-sorted.
mvcc_visible_version(versions: list[list], snap_ts: int) → int[[[1,0,10],[2,10,-1]],5]out1State 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.