Code Room
CodingHardcod-g1107
Subject CRDT OR Set replica mergeLevel Senior–Staff~32 minCommon in Distributed systems interviewsIndustries Technology

Question

An Observed-Remove Set (OR-Set) is a CRDT for a set that supports concurrent adds and removes without coordination. Each add of an element attaches a unique tag; a remove only retires the tags it has actually observed. Each replica state is a dict {"adds": [[elem, tag], ...], "removes": [tag, ...]}. To merge a list of replica states you union all (elem, tag) add-pairs and union all removed tags; an element is PRESENT in the merged set iff it has at least one add-tag that is not in the removed-tag set. Return the sorted list of present elements. This 'add-wins' rule is what lets a concurrent add survive a remove that never saw it.

Implement
orset_merge(replicas: list[dict]) → list[str]
Examples
in[[{"adds":[["x","t1"],["y","t2"]],"removes":["t1"]},{"adds":[["x","t3"]],"removes":[]}]]out["x","y"]
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.