Risky Fraud Ring
Updated
Problem statement
Stripe Fraud Ring Tasks
This problem is Task 3 of 3 in the Stripe fraud-ring sequence.
- Task 1: Directly Linked Users
- Task 2: Fraud Ring Size
- Task 3: Risky Fraud Ring (current)
Not every connected cluster is malicious. Each transaction includes a risk score, and a fraud ring should be blocked only when its average risk is high.
Each transaction log entry is formatted as user_id,device_id,credit_card,risk_score. Users are connected by shared devices or credit cards. The ring for a target user is the connected component containing that user.
A user with risk score 0 is trusted. Trusted users still keep the graph connected, but they are excluded from both the sum and count when computing the average risk score.
Return true if the average risk score of non-trusted users in the target ring is strictly greater than 75; otherwise return false.
Input
transactions: transaction rows formatted asuser_id,device_id,credit_card,risk_score.targetUser: the user to investigate.
Output
Return whether the target ring should be blocked.
Function
shouldBlockFraudRing(transactions: String[], targetUser: String) → booleanExamples
Example 1
transactions = ["Alice,D1,CC1,90","Bob,D1,CC2,0","Charlie,D2,CC2,80"]targetUser = "Alice"return = trueThe connected ring is Alice, Bob, and Charlie. Bob has score 0, so the average is (90 + 80) / 2 = 85, which is greater than 75.
Example 2
transactions = ["Alice,D1,CC1,70","Bob,D1,CC2,0","Charlie,D2,CC2,80"]targetUser = "Alice"return = falseBob still connects Alice and Charlie, but Bob is excluded from the average. (70 + 80) / 2 = 75, and the rule requires strictly greater than 75.
Constraints
- 0 <= transactions.length <= 10^5
- 0 <= risk_score <= 100
- Each user has the same risk score across all their transactions.
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
- Find Minimum City HopsAmazon · OA
- Shortest Path from Encoded Graph EdgesBitGo · OABitGo interview questions
- Race a Friend to a Shared HomeIntuit · OAIntuit interview questions
- Shortest Route Through a Traced MazeDuolingo · OADuolingo interview questions
- Word Chain Jumps in a GridGoogle · PHONE SCREENGoogle interview questions
- Hierarchical Permission CheckeBay · ONSITE INTERVIEWeBay interview questions
- Route Graph Reachability with a Broken LinkFigma · PHONE SCREENFigma interview questions
- Minimum Currency ConversionsEPAM · PHONE SCREENEPAM interview questions
- Finite Web CrawlerMongoDB · PHONE SCREEN · ONSITE INTERVIEWMongoDB interview questions
- Currency Conversion RateBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
Stripe interview experiences
- Stripe SWE Onsite over Two Days: 1 Experience
- Stripe New Grad SWE Phone Screen and Onsite: 2 Experiences
- Stripe AI Coding Interview, Experienced SWE: 6 Experiences
- Stripe SWE Intern Payout Scheduler Phone Screen: 1 Experience
- Stripe New Grad SWE Onsite and HM Round: 1 Experience
- Stripe Experienced MLE Phone Screens: 1 Experience