FastPrepDirectly Linked Users
Problems/Directly Linked Users

Directly Linked Users

Stripe logoStripe● EasyOA

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: I re-audited this problem against the original source and improved it for clarity and completeness on 2026-09-11. The source omits numeric input bounds. The judged core task matches the visible source at about 99%.

Stripe Fraud Ring Tasks

This problem is Task 1 of 3 in the Stripe fraud-ring sequence.

  1. Task 1: Directly Linked Users (current)
  2. Task 2: Fraud Ring Size
  3. 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 as user_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
See Stripe hiring insights
Saved
class Solution {
    public String[] findDirectlyLinkedUsers(String[] transactions, String targetUser) {
      // write your code here
    }
}
Checking account…