Flag Cash Deposit Structuring Within a Rolling 24 Hour Window
Last updated: November 29, 2026
Quick Overview
Given cash deposit events (account, timestamp, amount), flag every account that within any rolling 24 hour window makes at least three deposits each below a reporting threshold of 10,000 whose total reaches the threshold, returning the first such window.
UBS
November 29, 20260
0
0 solved
Given cash deposit events (account, timestamp, amount), flag every account that within any rolling 24 hour window makes at least three deposits each below a reporting threshold of 10,000 whose total reaches the threshold, returning the first such window.
Anti money laundering transaction monitoring is a core compliance system at any global bank, and splitting cash into amounts just under a reporting limit is a classic pattern it must detect. The interviewer checks sliding window technique, careful window boundaries, and whether you ask about unordered input and per-account grouping.
What the Interviewer Expects
- Group events per account and sort by time
- Filter to sub-threshold deposits before windowing
- Maintain a deque with a running sum for O(1) amortized updates
- Define the window boundary precisely (inclusive or exclusive at 24 hours)
- Discuss how the batch logic maps to a streaming system
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How would you run this on a Kafka stream with late-arriving events?
- How would you detect the same pattern spread across several related accounts of one client?
- How would you reduce false positives for businesses that legitimately deposit cash daily?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Events are (account, epoch seconds, amount) and may arrive unsorted. Only deposits strictly below 10,000 count, since larger ones are reported anyway. A window is the 24 hours ending at a deposit, her...
High-Level Design
Bucket deposits by account, sort each bucket by timestamp, then sweep with a deque. Append the new deposit, add its amount to a running total, and pop from the left while the oldest deposit is 24 hour...