Flag Cash Structuring Across a Rolling 24 Hour Window
Last updated: November 29, 2026
Quick Overview
Given a stream of cash deposits (customer, timestamp, amount in cents), flag each customer who makes two or more deposits that are each under $10,000 but together exceed $10,000 within any 24-hour window, and report the window found.
Wells Fargo
November 29, 20260
0
0 solved
Given a stream of cash deposits (customer, timestamp, amount in cents), flag each customer who makes two or more deposits that are each under $10,000 but together exceed $10,000 within any 24-hour window, and report the window found.
Under the Bank Secrecy Act, banks file Currency Transaction Reports for cash over $10,000 and must watch for customers splitting deposits to avoid them. Wells Fargo AML engineering builds detectors like this, and the interviewer checks a correct sliding window, boundary handling, and awareness that a rule like this feeds analysts, not automatic penalties.
What the Interviewer Expects
- Group by customer and sort by timestamp
- Use a sliding window with a deque and running sum, O(n log n) overall
- Define the window boundary precisely (inclusive or exclusive 24h)
- Exclude single deposits at or over the threshold since those already trigger a CTR
- Discuss false positives and how alerts are reviewed
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 live Kafka stream instead of a batch?
- Structurers use many branches and family members. How would you link related customers?
- How would you report every distinct suspicious window rather than the first?
- How would you tune the rule to reduce false positives for cash-heavy small businesses?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input: list of (customer, ts in seconds, amount_cents). Only deposits strictly under $10,000 count. Flag a customer if some window of length 24h (a deposit exactly 24h older falls outside) contains at...
High-Level Design
Bucket deposits by customer, sort each bucket by time, then sweep with a deque holding deposits inside the current window and a running total. Add the new deposit, evict from the front while it is 24h...