Rolling 24-Hour Velocity Limit for Wallet Withdrawals

Last updated: November 29, 2026

Quick Overview

Implement a wallet policy check that auto-approves a withdrawal only if the wallet's total sent in the trailing 24 hours, including this send, stays within its configured limit; otherwise the send must go to manual approval.

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

0

0

0 solved


Implement a wallet policy check that auto-approves a withdrawal only if the wallet's total sent in the trailing 24 hours, including this send, stays within its configured limit; otherwise the send must go to manual approval.

BitGo wallet policies let administrators cap how much can leave a wallet per time window before a second human must approve. This question tests sliding-window bookkeeping and the subtle rules about what counts toward the window.

What the Interviewer Expects
  • Uses a per-wallet queue with a running sum for O(1) amortized checks
  • Defines the window boundary precisely (strict or inclusive)
  • Decides and states whether rejected or pending sends count toward the window
  • Counts manually approved sends once they execute
  • Treats missing policy as no limit, explicitly
Key Topics to Cover
sliding window
deque
policy engine
rate limiting
concurrency
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 do you enforce this across many API servers at once?
  • How would you express the limit in USD when the wallet holds several coins?
  • What if a withdrawal later fails to broadcast?
  • How would a fixed calendar-day window differ, and why might an attacker prefer it?
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 arrive in timestamp order per wallet: (wallet, ts, amount). Limit is in base units per trailing 86,400 seconds. A send is auto-approved if spent_in_window + amount <= limit. Sends that requ...

High-Level Design

For each wallet keep a deque of counted (ts, amount) and a running total. On every check, pop from the left while the oldest entry is outside the window, subtracting from the total. Then compare. Th...


Submit Your Answer
Markdown supported

Related Questions