Transaction isolation conflicts
A database scheduler checks a batch of transactions for conflicts before letting them run together. Each entry of ops is one operation written as "billing|read|cart:12": the transaction name, a pipe, then read or write, then the key it touched. Names and keys hold no pipes, and an operation may repeat. Under read_committed two transactions conflict only when both wrote the same key. Under repeatable_read they also conflict when one wrote a key the other read. Under serializable they also conflict when they read at least one key in common and each wrote at least one key, which is the write skew case. A transaction never conflicts with itself, and isolation is always one of those three names. Return one entry per conflicting pair, each written as the two names joined by a comma with the smaller name first, sorted ascending as text.
conflicting_txn_pairs(ops: list[str], isolation: str) → list[str][["billing|read|cart:12","billing|write|cart:12","audit|read|cart:12","sync|write|cart:12"],"read_committed"]out["billing,sync"][["billing|read|cart:12","billing|write|cart:12","audit|read|cart:12","sync|write|cart:12"],"repeatable_read"]out["audit,billing","audit,sync","billing,sync"][["a|read|k1","a|write|k9","b|read|k1","b|write|k8"],"serializable"]out["a,b"]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.
[["billing|read|cart:12","billing|write|cart:12","audit|read|cart:12","sync|write|cart:12"],"read_committed"]["billing,sync"]not run yetsample[["billing|read|cart:12","billing|write|cart:12","audit|read|cart:12","sync|write|cart:12"],"repeatable_read"]["audit,billing","audit,sync","billing,sync"]not run yetsample[["a|read|k1","a|write|k9","b|read|k1","b|write|k8"],"serializable"]["a,b"]not run yetsample