Detect Accounts Involved in Circular Money Movement Rings

Last updated: November 29, 2026

Quick Overview

Given a list of directed transfers between accounts, return every account that lies on at least one directed cycle (including an account that sends to itself), as a first-pass anti-money-laundering signal.

Bank of America
Coding & Algorithms
Software Engineer
Bank of America
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Hard

0

0

0 solved


Given a list of directed transfers between accounts, return every account that lies on at least one directed cycle (including an account that sends to itself), as a first-pass anti-money-laundering signal.

An onsite graph problem in the style of the financial crimes technology teams, where layering through a ring of mule accounts is a classic laundering pattern. The interviewer looks for recognizing strongly connected components rather than running a cycle search from every node, and for an iterative implementation that survives graphs with millions of accounts.

What the Interviewer Expects
  • Recognize that a node is on a cycle exactly when its SCC has size above 1 or it has a self loop
  • Implement Tarjan or Kosaraju in linear time
  • Avoid recursion limits on deep graphs
  • Treat isolated chains and tree-like flows as clean
  • Discuss how to turn the raw signal into something an investigator can use
Key Topics to Cover
Strongly connected components
Tarjan's algorithm
Graph traversal
AML
Iterative DFS
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 only report cycles where money returns within 7 days?
  • How would you weight cycles by amount so tiny refunds do not flood investigators?
  • How would you run this daily over billions of transfers?
  • How would you return one concrete cycle as evidence for each flagged account?
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

Input: list of (src, dst) account pairs, possibly with duplicates and self transfers. Output: sorted list of accounts that lie on some directed cycle. Graph can be large, so the solution must be O(V +...

High-Level Design

A node is on a directed cycle if and only if it shares a strongly connected component with another node, or it has a self loop. So compute SCCs once with Tarjan's algorithm and keep components of size...


Submit Your Answer
Markdown supported

Related Questions