Group Customer Accounts Into Shared-Device Fraud Rings

Last updated: November 29, 2026

Quick Overview

Each N26 account has a list of identifiers such as device ids, phone numbers and payout IBANs. Two accounts are linked if they share any identifier, and links are transitive; return all groups with at least two accounts, largest first.

N26
Coding & Algorithms
Software Engineer
N26
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Medium

0

0

0 solved


Each N26 account has a list of identifiers such as device ids, phone numbers and payout IBANs. Two accounts are linked if they share any identifier, and links are transitive; return all groups with at least two accounts, largest first.

N26 operates under BaFin scrutiny on anti-money-laundering and onboarding fraud, so linking accounts that share devices or IBANs is a realistic task for risk engineering. The onsite interviewer checks that you see this as connected components, choose union-find or BFS deliberately, and avoid the quadratic pairwise comparison.

What the Interviewer Expects
  • Model accounts as nodes connected through shared identifiers
  • Avoid O(n^2) pairwise comparison by mapping identifier to first owner
  • Implement union-find with path compression and union by size
  • Return deterministic, sorted output
  • Discuss how to support incremental updates as new accounts onboard
Key Topics to Cover
union find
connected components
hash maps
fraud detection
graph modeling
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 handle a very common identifier, such as a shared office Wi-Fi device id, that would merge everything?
  • How do you support removing a link when an identifier is reassigned?
  • How would you run this daily over 10 million accounts?
  • Would you choose BFS over union-find here, and when?
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: dict account_id -> list of identifiers. Output: list of groups (sorted account ids) where every group has size >= 2, ordered by size descending then first id. Identifiers are opaque strings...

High-Level Design

This is connected components on a bipartite graph of accounts and identifiers. Instead of building edges between every pair of accounts sharing a device (which can be quadratic for a popular device), ...


Submit Your Answer
Markdown supported