Enforce Rolling Transfer Velocity Limits With Reversals

Last updated: November 29, 2026

Quick Overview

Build a limiter for peer-to-peer transfers that enforces several rolling windows at once (for example at most $500 and 3 transfers per hour, and $1,000 and 10 transfers per day per member), approving a transfer only if every window stays within limits. Reversed transfers must give their room back while they are still inside a window, and repeated reversals must be harmless.

Chime
Coding & Algorithms
Software Engineer
Chime
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Hard

0

0

0 solved


Build a limiter for peer-to-peer transfers that enforces several rolling windows at once (for example at most $500 and 3 transfers per hour, and $1,000 and 10 transfers per day per member), approving a transfer only if every window stays within limits. Reversed transfers must give their room back while they are still inside a window, and repeated reversals must be harmless.

An onsite coding problem in the spirit of Chime's Pay Anyone transfers, where velocity limits are a first line of defense against account takeover and fraud rings. The interviewer probes whether you can keep sums correct under deletions from the middle of a sliding window without rescanning history.

What the Interviewer Expects
  • Define window membership precisely (half-open interval)
  • Keep a deque and running sum and count per member per rule
  • Handle reversals with lazy deletion so eviction does not double subtract
  • Make reversal idempotent
  • Check every rule before mutating any state
  • State complexity per operation
Key Topics to Cover
Sliding Window
Deque
Lazy Deletion
Rate Limiting
Fraud Controls
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • Events can arrive a few seconds out of order. What changes?
  • How would you run this across many hosts with members sharded by id?
  • Limits should depend on account age and direct deposit status. Where does that config live?
  • How do you test window boundaries without real clocks?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Rules are (window_seconds, max_total_cents, max_count). A transfer approved at ts counts at time t if t - window < ts <= t and it has not been reversed. A new transfer is approved only if, for...

High-Level Design

Per member, per rule, keep a deque of transfer ids in time order plus a running sum and count. A global map holds id -> (member, ts, amount, reversed). Eviction pops from the left while the olde...


Submit Your Answer
Markdown supported

Related Questions