Directly Linked Users
Updated
Problem statement
Stripe Fraud Ring Tasks
This problem is Task 1 of 3 in the Stripe fraud-ring sequence.
- Task 1: Directly Linked Users (current)
- Task 2: Fraud Ring Size
- Task 3: Risky Fraud Ring
Financial crimes are rarely committed in isolation. Bad actors may spread activity across multiple user accounts, but shared identifiers can reveal connections.
Each transaction log entry is formatted as user_id,device_id. Two different users are directly linked if they use the same device. A single user may appear multiple times with different devices.
Given the log and a target user, return all users directly linked to the target user. The target user should not appear in the output. Return the user IDs in lexicographic order.
Input
transactions: transaction rows formatted asuser_id,device_id.targetUser: the user to investigate.
Output
Return the directly linked user IDs in lexicographic order, excluding targetUser.
Function
findDirectlyLinkedUsers(transactions: String[], targetUser: String) → String[]Examples
Example 1
transactions = ["Alice,D1","Bob,D1","Charlie,D2","David,D3","Eve,D1"]targetUser = "Alice"return = ["Bob","Eve"]Alice used D1. Bob and Eve also used D1.
Example 2
transactions = ["Alice,D1","Alice,D2","Bob,D2","Cara,D3"]targetUser = "Alice"return = ["Bob"]Alice is associated with D1 and D2, and Bob shares D2.
Constraints
- 0 <= transactions.length <= 10^5
- User IDs and device IDs contain no commas.
More Stripe Online Assessment questions
- Financial Account LedgerOA · PHONE SCREEN · Seen Nov 2026
- Chat Billing CalculationOA · Seen Nov 2026
- Deployment Window SchedulerOA · Seen Nov 2026
- Asynchronous Event ProcessingOA · Seen Nov 2026
- Subscription and Usage-Based Billing CalculatorOA · Seen Nov 2026
- Split Tender Part 4 - RefundsOA · PHONE SCREEN · Seen Nov 2026
- Request Routing SystemOA · Seen Nov 2026
- Incident MonitorOA · Seen Nov 2026
- Split Tender Part 3 - SurchargesOA · Seen Nov 2026
- Split Tender Part 2 - Expiration DatesOA · Seen Nov 2026
Similar questions at other companies
- Network Endpoint or Cycle BoundaryOpenAI · OA · PHONE SCREEN
- Check Path PresenceMicrosoft · OA
- Nodes With Zero or One ParentCompass International Holdings · OA
- Middle Course in a Prerequisite ChainIntuit · OA
- Job Runner Chain ReportsHeadlands Technologies · OA
- Top Mutual-Friend RecommendationsVisa · OA
- Top Mutual-Friend RecommendationsSuperhuman · OA
- Find Minimum City HopsAmazon · OA
- Shortest Path from Encoded Graph EdgesBitGo · OA
- Social Media SuggestionsCitadel · OA