This question evaluates a candidate's competence in designing efficient data structures and streaming/top‑K algorithms, handling event-driven updates, correctness under late or expired events, deterministic tie‑breaking, and scalability to millions of customers.

Maintain and return the top N customers by cumulative activity amount, where activity is defined as the sum of deposit amounts, pay amounts, and transfer amounts only when the transfer is successfully accepted (expired transfers contribute nothing). Design data structures and an API (e.g., getTopNActivity(N)) that support near‑real‑time updates as operations occur and efficient queries. Specify update and query complexities, handle late accept events that change a customer’s activity, ensure correctness when transfers expire, define deterministic tie‑breaking (e.g., by customerId then most‑recent activity), and discuss how you would handle changing N between queries and scale to millions of customers.