Compute balances and array queries | Current Interview Question