Code RoomAccounts receivable lanes
EasyPrep Room Coding #4722

Accounts receivable lanes

CodingDistributed systemsAlgorithms & data structuresEntry–Mid~12 min

A billing run groups an accounts receivable ledger into three collection lanes before it prints. Each row is a string id|balance_cents|days_past_due, for example INV-1042|1500|4, and the fields are always in that order. Balance is in cents and can be zero or negative once a credit is applied. Days past due can be negative when the invoice is not due yet. A row belongs to the paid lane when its balance is zero or below, whatever its days say. Otherwise it belongs to the overdue lane when days past due is greater than zero, and to the due lane when days past due is zero or below. Return only the ids, overdue lane first, then due, then paid. Within a lane keep the order the rows arrived. An empty ledger returns an empty list.

Implement
split_invoice_lanes(rows: list[str]) → list[str]
Examples
in[["INV-1|1500|4","INV-2|0|0","INV-3|900|-2"]]out["INV-1","INV-3","INV-2"]
in[["INV-9|-250|30"]]out["INV-9"]
in[["AR-7|250|1","AR-8|250|0"]]out["AR-7","AR-8"]
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 12 min
InputExpectedGot
[["INV-1|1500|4","INV-2|0|0","INV-3|900|-2"]]["INV-1","INV-3","INV-2"]not run yetsample
[["INV-9|-250|30"]]["INV-9"]not run yetsample
[["AR-7|250|1","AR-8|250|0"]]["AR-7","AR-8"]not run yetsample