Grokking Amazon Coding Interview
Ask Author
Back to course home

0% completed

Solution: Concatenated Words
Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Problem Statement

Given a words array containing non-duplicate strings, return all the concatenated words that are in the words array.

A concatenated word is a string that is formed entirely of at least two shorter words (May be same) of the given array.

Examples

  • Example 1:
    • Input: words = ["tree","cat","cattree","dog","catdog"]
    • Expected Output: ["cattree", "catdog"]
    • Justification: 'cattree' is formed by concatenating 'cat' and 'tree'. Similarly, 'catdog' is a combination of 'cat' and 'dog'

.....

.....

.....

Like the course? Get enrolled and start learning!

Table of Contents

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible

Contents are not accessible