This question evaluates a candidate's ability to design efficient aggregation and top-N ranking over transactional data, testing algorithm design, data structure knowledge, and complexity analysis within the Coding & Algorithms domain.

Add a feature to report the top N accounts by total outgoing payments across both immediate pays and scheduled payments. Implement: List<String> topNSpenders(int n) that returns N strings each formatted as "{accountId}{amount}", where amount is the cumulative spent amount for that account. Support online updates after every payment with O(log N) update time by maintaining per-account totals and a size-N min-heap (or equivalent). Specify tie-breaking rules, query/update complexity, and how deletions/merges affect the ranking.