Company: Stripe
Difficulty: medium
Linked Merchant Groups A payments platform stores merchant profiles as flat dictionaries that have been serialized into rows of alternating keys and values: [key1, value1, key2, value2, ...] Every row contains exactly one merchant_id key, and its value is non-empty and unique across all rows. A row may also contain the identity fields email , phone and address , plus arbitrary additional fields such as country or mcc . Two rows are directly linked when they share the same non-empty value under the same identity key. That is, rows A and B are directly linked if there is a key K in {email, phone, address} such that both rows contain K , both of their values for K are non-empty, and those two values are identical. An empty value never links anything, a value that matches under a different key never links anything, and additional fields (anything outside merchant_id , email , phone , address ) never establish a link even when their values match. A merchant group is a set of rows closed und