FastPrepConcatenated Words
Problems/Concatenated Words

Concatenated Words

Amazon logoAmazon● HardFULLTIMEINTERNNEW GRADPHONE SCREENONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in Amazon phone screens for full-time, intern, and new grad roles. The report describes a trie and DFS variant of the well-known concatenated words problem. It does not keep any rule that is special to the variant. Our version returns the input words that are built from at least two shorter input words, in input order, and we set the limits. Our version is about 82% the same as the reported question.

Return every word in words that can be built by joining at least two shorter words from the same list.

You may use the same shorter word more than once. A word does not count as built from itself alone. Return the matching words in the same order they appear in words.

Function

findConcatenatedWords(words: String[]) → String[]

Examples

Example 1

words = ["cat","cats","dog","catsdog","dogcat","rat"]return = ["catsdog","dogcat"]

catsdog is cats followed by dog, and dogcat is dog followed by cat. Both parts are shorter input words each time. None of the other words can be split this way, so the result is ["catsdog","dogcat"].

Example 2

words = ["a","aa","aaa","aaaa"]return = ["aa","aaa","aaaa"]

aa is two copies of a, aaa is three copies, and aaaa is four copies. Reusing a word is allowed. a has no shorter word to build it from, so it is left out. The result is ["aa","aaa","aaaa"].

Example 3

words = ["catdog","cat","dog"]return = ["catdog"]

catdog is cat followed by dog. Both components are shorter input words. Neither cat nor dog can be formed from two shorter input words, so the result is ["catdog"].

Constraints

  • 1 <= words.length <= 10000.
  • Words are unique and contain one to thirty lowercase ASCII letters.
  • The sum of all word lengths is at most 100000.

More Amazon Phone Screen questions

  • LRU Cache for Query ResultsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Course SchedulePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Course Schedule IIPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Minimum Time to Spread Through a GridPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Consistent-Hash Packet RouterPHONE SCREEN · Seen Nov 2026
  • Count Connected ComponentsPHONE SCREEN · Seen Nov 2026
  • Second Largest Distinct ElementPHONE SCREEN · Seen Nov 2026
  • Task SchedulerOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Top K Frequent ElementsOA · PHONE SCREEN · Seen Nov 2026
  • Number of IslandsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Word Break IIWex · PHONE SCREEN
  • Word Break IIBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
  • Word Break IIGoogle · ONSITE INTERVIEWGoogle interview questions
  • Highlight and Rank Overlapping CitationsHarvey · PHONE SCREEN · ONSITE INTERVIEWHarvey interview questions
  • Minimum Insertion Steps to Make a String PalindromeInfosys · ONSITE INTERVIEWInfosys interview questions
  • Wildcard MatchingTripjack · ONSITE INTERVIEWTripjack interview questions
  • Design Search Autocomplete SystemRoblox · PHONE SCREEN · ONSITE INTERVIEWRoblox interview questions
  • Interleaving StringsCARS24 · ONSITE INTERVIEW
  • Word Break IIInMobi · PHONE SCREENInMobi interview questions
  • Minimum Stickers to Form a Target StringByteDance · ONSITE INTERVIEWByteDance interview questions

Interview reports that mention this question

  • Amazon New Grad SDE I OA and Virtual Onsite: 1 Experience
  • Amazon SDE II (L5) Interview Questions: 5 Experiences

Amazon interview experiences

  • Amazon Experienced SDE Onsite Questions: 1 Experience
  • Amazon SDE Onsite Interview Questions: 9 Experiences
  • Amazon SDE II and L5 FDE Interview Questions: 4 Experiences
  • Amazon Full-Time OA Problems, Earlier Reports (Part 5 of 5)
See Amazon hiring insights
Saved
class Solution {
    public String[] findConcatenatedWords(String[] words) {
        // Write your code here.
    }
}
Checking account…