Quorum write safety
A control plane replicates every feature flag write to replica_count storage replicas, and it is configured with a write quorum and a read quorum. A write counts as safely committed only when three things hold. Each quorum is no larger than replica_count, so it can actually be assembled. write_quorum plus read_quorum is greater than replica_count, so any later read is forced to touch at least one replica that took the write. And at least write_quorum replicas acknowledged that particular entry. Entry i of the log wrote flag_names[i] and collected ack_counts[i] acknowledgements. Return the flag names of the entries that are not safely committed, in log order. A flag written twice is reported once per failing entry. Return an empty list when every entry is safe.
writes_missing_quorum(replica_count: int, write_quorum: int, read_quorum: int, flag_names: list[str], ack_counts: list[int]) → list[str][3,2,2,["dark_mode","new_checkout","beta_banner"],[3,2,1]]out["beta_banner"][3,2,1,["search_boost","free_trial"],[3,2]]out["search_boost","free_trial"][5,3,3,["retry","retry","retry"],[3,2,3]]out["retry"]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.
[3,2,2,["dark_mode","new_checkout","beta_banner"],[3,2,1]]["beta_banner"]not run yetsample[3,2,1,["search_boost","free_trial"],[3,2]]["search_boost","free_trial"]not run yetsample[5,3,3,["retry","retry","retry"],[3,2,3]]["retry"]not run yetsample