← Questions
Group merchant records that share contact details
0
I was asked this
No reports yet. Sign in to say where you were asked it.
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.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Sign in to submit your code; every attempt is kept here.
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
