Detect Cash Structuring Across Linked Accounts Within 24 Hours
Last updated: November 29, 2026
Quick Overview
Given cash deposits (account, timestamp, amount) and links between accounts that share an owner, phone or device, flag each linked group that makes at least three deposits each below the $10,000 reporting threshold whose total within any rolling 24 hour window reaches $10,000.
JPMorgan Chase
November 29, 20260
0
0 solved
Given cash deposits (account, timestamp, amount) and links between accounts that share an owner, phone or device, flag each linked group that makes at least three deposits each below the $10,000 reporting threshold whose total within any rolling 24 hour window reaches $10,000.
JPMorgan Chase runs large Bank Secrecy Act and anti-money-laundering programs, and structuring (splitting cash to avoid a Currency Transaction Report) is a classic pattern that often spans several related accounts. The interviewer wants you to combine union-find for entity resolution with a sliding window, and to talk about the precision and fairness concerns of an alerting rule.
What the Interviewer Expects
- Resolves linked accounts into groups with union-find (path compression, union)
- Filters to sub-threshold deposits before windowing
- Sorts each group's events and runs a two-pointer sliding window on time
- Gets the window boundary right (strictly less than 24 hours)
- Discusses complexity and how alerts flow to investigators
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
- Links change over time. How would you handle a link that was created after the deposits?
- How would you run this continuously on a Kafka stream instead of in batch?
- Investigators complain about alert volume. Which knobs would you expose and how would you measure precision?
- How would you prevent one huge group (for example a shared branch device) from linking unrelated customers?
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: deposits (account, ts_seconds, amount) and undirected links. Rule: inside a linked group, consider only deposits below the threshold. Flag the group if some window of length under 24 hours ...
High-Level Design
- Union-find over all accounts in deposits and links. Linking is transitive: A to B and B to C puts A, B, C in one group.
- Bucket qualifying deposits by group root.
- For each group, sort by time ...