Code Room
CodingMediumcod-g1100
Subject Read repair reconciliation across replicasLevel Mid–Senior~25 minCommon in Distributed systems interviewsIndustries Technology

Question

During a read, the coordinator gathers each replica's view of a key as [replica_id, version, value], where higher integer `version` is fresher and ties are broken by the lexicographically larger `value` (a deterministic last-write-wins conflict resolver). The winning (version, value) is the freshest under this rule. Return a list of replica_ids (sorted ascending as strings) that are STALE — i.e., whose (version, value) is not equal to the winning pair — because the coordinator must send them the repaired value. If all replicas already agree, return an empty list.

Implement
read_repair_targets(replica_views: list[list]) → list[str]
Examples
in[[["r1",5,"blue"],["r2",5,"blue"],["r3",4,"red"]]]out["r3"]
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.