Search
⌘K

Leetcode 472. Concatenated Words

Return all strings in the list that can be formed by concatenating at least two other words from the same list. This is a word-break style problem (use DP/trie + memoization) to efficiently test each word given total input size up to 1e5.

Asked at:

Amazon

Amazon


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Mid September, 2024

Amazon

Amazon

Mid-level

Given a large list of words, find all combinations where one word is a composite of two or more words from the same list. Input: [rockstar, rock, stars, rocks, tar, star, rockstars, super, highway, high, way, superhighway]. Output: [[rock, star], [rocks, tar], [super, highway], [super, high, way],...]

Comments

Your account is free and you can post anonymously if you choose.