← Questions

Group merchant records that share contact details

0
StripeCodingLast asked Jul 2026

Each merchant record is a set of key-value pairs with a merchant ID and, optionally, an email, a phone number and an address, plus other fields. Two records are linked when they have the same non-empty value for one of those three identity fields. Links are transitive.

Return every group of linked merchants, IDs sorted within a group and groups sorted. Other fields never create links. Compare a union-find solution with a graph traversal, and say how you would handle records arriving one at a time.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding