Amazon Phone Screen
Anonymous User
1367

I got a question where input and output is like below.

input:
[['John', 'john@mail.com', 'john2@mail.com']
['John', 'john@mail.com', 'john3@mail.com']
['Mary', 'mary@mail.com']
['John', 'john4@mail.com']]
Output:
[[John, 'john@mail.com', 'john2@mail.com', 'john3@mail.com']
[Mary, 'mary@mail.com']
['John', 'john4@mail.com']]

Basically, if the users have same email, we consider them as a same person and merge their email list. Having the same name does not mean that they are the same person. How would you solve this?

Comments (6)