Code RoomVector clock merge on receive
EasyPrep Room Coding #259

Vector clock merge on receive

CodingDistributed systemsEntry–Mid~18 min

When a replica receives a message, it merges the incoming vector clock with its own by taking the componentwise maximum, then increments its own entry by one to account for the receive event. Given the local node's id `me`, the local vector clock `local` (a dict; missing node = 0), and the incoming vector clock `incoming`, return the merged-and-incremented vector clock as a dict that includes every node mentioned in either clock plus `me`.

Implement
vc_merge_recv(me: str, local: dict[str,int], incoming: dict[str,int]) → dict[str,int]
Examples
in["n1",{"n1":2,"n2":1},{"n1":1,"n2":3,"n3":1}]out{"n1":3,"n2":3,"n3":1}
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.

0:00 of about 18 min
InputExpectedGot
["n1",{"n1":2,"n2":1},{"n1":1,"n2":3,"n3":1}]{"n1":3,"n2":3,"n3":1}not run yetsample