Stripe interview question
Group accounts that are directly or indirectly similar
- Company:
- Stripe
- Type:
- Coding
- Difficulty:
- Medium
- Reported:
- November 16, 2026
Problem
You are given a list of accounts, each with an id and some metadata fields. The task came in parts:
- The first parts compare accounts pairwise: when their metadata fields match (for example the same name), the two accounts are judged to belong to the same person.
- The next part adds transitivity: if A is related to B and B is related to C, then A and C are also related even if they do not match directly. Return the groups of related accounts.
Which fields must match was not specified beyond the name example, so the matching rule is passed in as a function is_match(a, b).
Example 1
Input: a1 {name: "name_a", email: "x@ex"}, a2 {name: "name_b", email: "x@ex"},
a3 {name: "name_b", email: "y@ex"}, a4 {name: "name_c", email: "z@ex"}
is_match = same name or same email
Output: [["a1","a2","a3"], ["a4"]]
a1 and a2 share an email, a2 and a3 share a name, so a1 and a3 are related through a2.
Example 2
Input: same accounts, is_match = same name
Output: [["a1"], ["a2","a3"], ["a4"]]
Only a2 and a3 match directly, and nothing links a1 to them.
Constraints
- Not stated; ask the interviewer.
Reported by candidates or drawn from publicly available sources, and rewritten in our own words. Pathwise Prep does not publish confidential assessment content. Report a concern