redeem(ledger, points) where ledger is a list of [earned_day, amount] batches sorted by day: consume points FIFO, mutating the ledger (drop exhausted batches, reduce partial ones) and returning True — or return False and leave the ledger untouched when the balance is short.redeem([[1, 100], [5, 50]], 120)
True, ledger becomes [[5, 30]]
The day-1 batch is drained, 20 taken from day-5.
Check sum first for the atomicity guarantee.
Then walk from the front, slicing off consumed batches.