Reconcile ledger transactions
Two systems each export a ledger of the day's transactions as rows "id,amount" (amount an integer; each id appears at most once per ledger). A transaction needs review when the two ledgers disagree: the amounts differ, or the id appears in only one ledger. Return the ids needing review, sorted ascending. Example: ledger_a ["t1,100", "t2,50", "t3,75"] and ledger_b ["t1,100", "t2,60", "t4,20"] give ["t2", "t3", "t4"].
Implement
reconcile_ledgers(ledger_a: list[str], ledger_b: list[str]) → list[str]Examples
in
[["t1,100","t2,50","t3,75"],["t1,100","t2,60","t4,20"]]out["t2","t3","t4"]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 15 min
solution.py
InputExpectedGot
[["t1,100","t2,50","t3,75"],["t1,100","t2,60","t4,20"]]["t2","t3","t4"]not run yetsample