Amazon | Onsite | Concatenated Words

If there is a word array/list, please find the word lists that contains all the words that can composite another word in the origin word array. E.g.

If the input word array/list is:
['car','super','supercar','hero','superhero','superherocar','spring','flower','springflower','winter','cool']

Please return me the array as below:
[['car','super', 'supercar'],
['super', 'hero', 'superhero'],
['car','super','hero','superherocar'],
['spring', 'flower','springflow']]

Variation of https://leetcode.com/problems/concatenated-words

Comments (11)