Detect words formed by multiple dictionary parts

Quick Overview

This question evaluates proficiency in string processing, selection and use of appropriate data structures and algorithms (hashing, tries), dynamic programming and memoization, and complexity analysis for large inputs and edge-case handling within the Coding & Algorithms domain.

Detect words formed by multiple dictionary parts

Company: Amazon

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

Given an array words of up to 100,000 non-empty lowercase strings (total characters ≤ 1,000, 000), return all strings that can be formed by concatenating at least two other strings from the same array. Component strings may be reused multiple times. Describe two approaches (hash-set with dynamic programming, and trie with DFS plus memoization), analyze time and space complexity, and explain how to avoid counting a word as itself unless it is split into smaller parts. Discuss edge cases such as very short words, repeated components, and large inputs.

Overview: This question evaluates proficiency in string processing, selection and use of appropriate data structures and algorithms (hashing, tries), dynamic programming and memoization, and complexity analysis for large inputs and edge-case handling within the Coding & Algorithms domain.

|Home/Coding & Algorithms/Amazon
Amazon logo
Amazon
Sep 6, 2025
mediumSoftware EngineerTechnical ScreenCoding & Algorithms
3
0

Given an array words of up to 100,000 non-empty lowercase strings (total characters ≤ 1,000, 000), return all strings that can be formed by concatenating at least two other strings from the same array. Component strings may be reused multiple times. Describe two approaches (hash-set with dynamic programming, and trie with DFS plus memoization), analyze time and space complexity, and explain how to avoid counting a word as itself unless it is split into smaller parts. Discuss edge cases such as very short words, repeated components, and large inputs.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...