Compute balances and array queries
Problem Description
Given a list of transactions, where each transaction includes a userId and an amount. The amount is positive for a credit and negative for a debit. The task is to compute the final balance for every unique userId.
AI interview prep
Core dilemma
Efficiently aggregating and maintaining user balances from a potentially large batch of transactions, while anticipating future requirements for dynamic updates and complex queries.
3 tradeoffs and 3 stress tests locked
Interview prep
Unlock the interviewer X-Ray rubric, tradeoff matrix, stress tests, clarifying questions, and key concepts.
Compute balances and array queries
Problem Description
Given a list of transactions, where each transaction includes a userId and an amount. The amount is positive for a credit and negative for a debit. The task is to compute the final balance for every unique userId.