Find Round-Trip Fund Flows in an Intercompany Transfer Graph

Last updated: November 29, 2026

Quick Overview

Given transfers (id, from_entity, to_entity, day, amount), find every chain of 2 to 4 transfers that returns money to the originating entity within 7 days, with strictly increasing dates, amounts within 10% of the first transfer, and no entity visited twice.

EY
Coding & Algorithms
Software Engineer
EY
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Hard

0

0

0 solved


Given transfers (id, from_entity, to_entity, day, amount), find every chain of 2 to 4 transfers that returns money to the originating entity within 7 days, with strictly increasing dates, amounts within 10% of the first transfer, and no entity visited twice.

Round-tripping (moving cash out and back through related parties to inflate revenue or disguise its source) is a forensic and anti-money-laundering pattern that EY Forensic and audit analytics teams look for. The interviewer checks a time-respecting cycle search, pruning that keeps it tractable and clear reasoning about duplicates.

What the Interviewer Expects
  • Model transfers as time-stamped directed edges
  • Run a bounded DFS that only follows later transfers within the window
  • Prune on amount tolerance, depth and visited entities
  • Explain why rotations of the same cycle cannot be double reported
  • Analyze worst-case complexity and how sorting enables early termination
Key Topics to Cover
temporal graphs
depth-limited DFS
backtracking
pruning
forensic analytics
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 scale this to 100 million transfers a day?
  • How would you allow the amount to shrink by fees at each hop?
  • How would you rank found cycles for an investigator?
  • What if one transfer is split into several smaller ones mid-chain?
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

A valid chain t1..tk has k between 2 and max_len, each transfer starts where the previous ended, dates strictly increase, the whole chain spans at most window days, every amount is within tol of...

High-Level Design

Group outgoing transfers by source, sorted by day. For each transfer as a starting edge, DFS forward: from the current entity, consider outgoing transfers strictly after the last day; stop scanning on...


Submit Your Answer
Markdown supported

Related Questions