Find Every Dictionary Word Hidden in an Apple Arcade Letter Grid
Last updated: November 29, 2026
Quick Overview
For a word puzzle game, given an m by n grid of letters and a list of dictionary words, return all words that can be formed by moving between horizontally or vertically adjacent cells without reusing a cell within one word.
Apple
November 29, 20260
0
0 solved
For a word puzzle game, given an m by n grid of letters and a list of dictionary words, return all words that can be formed by moving between horizontally or vertically adjacent cells without reusing a cell within one word.
Game-style grid search is a familiar Apple onsite question, and this one combines backtracking with a trie. The interviewer is checking that you search once from each cell guided by the trie instead of running a separate search per word, and that you prune aggressively.
What the Interviewer Expects
- Build a trie of all dictionary words
- DFS from every cell following trie edges only
- Mark cells visited during the current path and restore them on backtrack
- Record a word at its terminal node and clear it to avoid duplicates
- Prune trie branches that are exhausted
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- Allow diagonal moves as in Boggle; what changes?
- Score words by length and return the top 10 scoring words.
- The dictionary has 200,000 words; how much memory does the trie take and how can you shrink it?
- Precompute for a daily puzzle on a server versus computing on device.
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
Input: board as a list of lists of lowercase letters and words. Output: sorted list of distinct found words. Each cell can be used once per word. Empty board or word list returns an empty list....
High-Level Design
Insert every word into a trie whose terminal nodes store the word. Start a DFS at each cell whose letter is a child of the root. At each step, move into the trie child for the current letter; if that ...