Code RoomTwo-phase commit outcome
EasyPrep Room Coding #272

Two-phase commit outcome

CodingConcurrencyDistributed systemsEntry–Mid~20 min

A coordinator runs two-phase commit across participants. In the prepare phase each participant votes: 'yes', 'no', or 'timeout' (no reply within the window). The protocol commits ONLY if every participant voted 'yes'; if any participant voted 'no' or 'timeout', the coordinator aborts. Given the list of votes, return 'commit' or 'abort'. An empty participant set commits (vacuously, nothing to coordinate).

Implement
two_phase_decision(votes: list[str]) → str
Examples
in[["yes","yes","yes"]]out"commit"
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 20 min
InputExpectedGot
[["yes","yes","yes"]]"commit"not run yetsample