Back to problems

Aggregate Recent Transactions

Algorithm · Affirm · Medium

A payment platform keeps a log of transactions and periodically produces a summary of recent completed ones. Each entry in transactions[i] is an array of five strings in this exact order: [amount, merchantId, status, userId, startTime]. amount — a decimal string representing the transaction amount. merchantId — the identifier of the merchant involved. status — one of "COMPLETED", "PENDING", or "FAILED". userId — the identifier of the user who initiated the transaction.…

Checking your access…