Find Every Dictionary Word Hidden in a Sticker Letter Grid
Last updated: November 29, 2026
Quick Overview
Given an m by n grid of letters from a word-game sticker pack and a list of dictionary words, return every word that can be traced by moving between horizontally or vertically adjacent cells without reusing a cell within one word.
Meta
November 29, 20260
0
0 solved
Given an m by n grid of letters from a word-game sticker pack and a list of dictionary words, return every word that can be traced by moving between horizontally or vertically adjacent cells without reusing a cell within one word.
This is a classic Meta onsite Hard because the naive approach (one grid search per word) times out, and the fix is to search all words at once with a trie. Interviewers watch for pruning: removing found words and dead branches so later searches get faster.
What the Interviewer Expects
- Explain why per-word DFS is too slow for large dictionaries
- Build a trie and DFS the grid once per starting cell
- Mark visited cells in place and restore them on backtrack
- Record each word once and prune exhausted trie branches
- Give a realistic complexity bound
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
- How would you handle diagonal moves too?
- What if the same cell may be reused within a word?
- How would you parallelize across starting cells?
- How would you return the coordinates of each found word?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
- Grid cells hold lowercase letters; words are lowercase and may repeat in the input.
- A word is found if some path spells it with 4-directional moves and no cell reused in that path.
- Return each f...
High-Level Design
Insert all words into a trie where the terminal node stores the full word. Then start a DFS from every cell, descending in the trie in lockstep with the grid. When a node holds a word, record it and c...