Reject Withdrawals That Breach a Rolling 24-Hour Limit

Last updated: November 29, 2026

Quick Overview

Process a time-ordered stream of withdrawal requests across many users and reject any request that would push that user's accepted withdrawals in the trailing window above a limit. Rejected requests do not count toward later windows.

Coinbase
Coding & Algorithms
Software Engineer
Coinbase
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Medium

0

0

0 solved


Process a time-ordered stream of withdrawal requests across many users and reject any request that would push that user's accepted withdrawals in the trailing window above a limit. Rejected requests do not count toward later windows.

Withdrawal velocity limits are a core risk control at Coinbase, protecting customers when an account is compromised. The interviewer checks a per-key sliding window with a running sum, correct window boundaries and the subtle rule that rejected requests are not counted.

What the Interviewer Expects
  • Use a per-user deque of accepted withdrawals and a running total
  • Evict entries that fall out of the window before evaluating the new request
  • Define the window boundary precisely (inclusive or exclusive)
  • Do not add rejected amounts to the window
  • Give amortized O(1) per event analysis
Key Topics to Cover
sliding window
deque
hashing
rate limiting
stream processing
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
  • How would you shard this across machines when events arrive out of order?
  • How would you support limits per asset converted to USD at withdrawal time?
  • What changes if the limit also caps the number of withdrawals per hour?
  • How do you persist state so a restart does not reset everyone's window?
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

Events are (ts, user, amount) sorted by ts in seconds. A request at ts is rejected when the sum of that user's accepted amounts in (ts - window, ts] plus the new amount exceeds limit. Return...

High-Level Design

For each user keep a deque of (ts, amount) for accepted withdrawals and a running total. On each event, pop from the left while the oldest entry is at or before ts - window, subtracting its amount...


Submit Your Answer
Markdown supported