Search
⌘K

Find Words That Contain Other Words as Substrings

Given a list of words, implement a function that returns all words containing other words from the list as substrings. For example, given ['apple', 'app', 'banana', 'nana'], return ['apple', 'banana'] since 'apple' contains 'app' and 'banana' contains 'nana'.

Asked at:

Meta


Hello Interview Answer Key

Word Container

A detailed walkthrough of the Word Container problem, covering the approach, implementation, and optimization.

Question Timeline

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

Mid May, 2026

Meta

Senior

Like others reported. It's an open-ended question. The interviewer wanted to see how you'd approach and breakdown the problem. I started by explaining the limitation and point of improvement for the existing brute force solution. Then the interviewer asked me if I can optimize it. I opted-in to brainstorm with AI at this moment (Not sure if that's the right timing though). A benchmark was provided and was run against my two other optimizations, Hashset for substrings and Trie. The interviewer asked me if I can optimized the two solutions further, either by merging lines of code or variables.

Late April, 2026

Meta

Senior

The problem's core was exactly the same! Had to find the container words. The focus is not on the best solution, but how you articulate your thoughts, keep the interviewer in the loop, and start with first iteration of improvement - that will improve the benchmarks. A simple sorting with early pruning gave significant improvement for the benchmarks. Just explained Trie by drawing, and the interviewer asked a couple of edge-cases on it.

Early April, 2026

Meta

Manager

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