Coinbase phonescreen question

Anonymous User
7898
Sep 07, 2021

Give a list of string list, the inner list represents the related strings, and the question was to find the relevant string for each string. The most relevant string refers to the most common occurrences of other strings and this string.

Input:
[['Casper', 'Purple', 'Wayfair'],['Purple', 'Wayfair', 'Tradesy'],['Wayfair', 'Tradesy', 'Peloton']]

Output:
{
'Casper': ['Purple', 'Wayfair'],
'Purple': ['Wayfair'],
'Wayfair': ['Purple', 'Tradesy'],
'Tradesy': ['Wayfair'],
'Peloton': ['Wayfair', 'Tradesy']
}

I was unable to find the optimal solution during the phone screen.

Comments (14)