Code AnalysisHard 60s
CRDT operation design
# collaborative todo list
class TodoList:
def __init__(self):
self.items = []
def add(self, name):
self.items.append(name)
def remove(self, name):
if name in self.items:
self.items.remove(name)
# two replicas: A adds 'x' then removes 'x'; B concurrently adds 'x'
A plain list with append/remove does not converge across replicas. Which change makes the structure a proper CRDT?
Think you can answer under pressure?
Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.