Reported July 2026
Stripehash table

Directly Linked Users

Reported by candidates from Stripe's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Stripe OA. Under 2s to a working solution.
Founder's read

Stripe's July 2026 OA reports include a fraud-ring sequence, and Directly Linked Users is Task 1 of 3. It looks like a warm-up, and it is. But the edge case that breaks a naive solution is hiding in the details: the target user can show up on several devices, and other users can repeat rows. It's a hash-table problem with a set at the end. If you've got an invite in your inbox, this is the one to get clean and fast so you have time for the two harder tasks. StealthCoder is the safety net if you blank during the live OA.

The problem

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 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.

Reported by candidates. Source: FastPrep

Pattern and pitfall

The trick is two passes. Pass one: scan the log and collect every device the target user touched into a set. Pass two: scan again and, for each row whose device is in that set, add the user to a result set, skipping the target. Sort lexicographically at the end. The common pitfall is returning duplicates. A user who shares two devices with the target, or appears in repeated rows, must show up once, so use a set, not a list. Another trap is forgetting to exclude the target when they appear on multiple devices. Also handle an empty log and a target who isn't in the log, both of which should return an empty array. Split each row on the first comma only, though the constraints say IDs contain no commas. This runs in O(n log n) with the sort, which is fine for 10^5 rows. Build the device-to-users map now, because Tasks 2 and 3 reuse it. If you freeze live, StealthCoder is the hedge that reads the problem and hands you the structure.

If this hits your live OA and you blank, StealthCoder solves it in seconds, invisible to the proctor.

If this hits your live OA

You can drill Directly Linked Users cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Stripe's OA.

Stripe reuses patterns across OAs. Built by an Amazon engineer who would have shipped this the night before his JPMorgan OA if he'd had it. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Directly Linked Users FAQ

How hard is Directly Linked Users really?+

Easy. It's a hash set and a sort. The only way to lose points is duplicates in the output or leaving the target user in. Get it right in a few minutes so you can spend your time on Fraud Ring Size and Risky Fraud Ring.

What's the trick to avoid duplicate users in the output?+

Store results in a set, not a list. A user can match the target on several devices or appear in repeated rows. The set collapses all of that, and you convert it to a sorted array only at the end.

Should I build a device-to-users map or just do two passes?+

Either works. Two passes is simpler: collect the target's devices, then collect users on those devices. A device-to-users map costs a bit more code but pays off because Tasks 2 and 3 in this sequence build on the same linking idea.

What edge cases should I test before submitting?+

Test an empty transactions array, a target who never appears, a target on multiple devices, another user sharing two devices with the target, and a target who appears in rows with the same device twice. Each should return clean, sorted, deduplicated output.

How do I prepare for this in 48 hours?+

Write it once from scratch with sets and a sort, then extend it to connected components, since later tasks in the sequence ask about ring size. Practice parsing strings like user,device quickly. Don't over-prep this one, it's the easy task.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Stripe.

OA at Stripe?
Invisible during screen share
Get it