← Uber Interview Insights

Uber·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Apr 2026Remote

Summary

Uber SWE coding round, got a word search problem and spent most of the time figuring out which solution they actually wanted. Not a bad experience but definitely left wondering if I explained the tradeoffs well enough.

Questions Asked (1)

Q1

Given a grid of characters and a list of words, find all words from the list that can be formed by moving through adjacent cells (up/down/left/right) without reusing the same cell in a single word.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

I started with the naive approach of searching each word independently using DFS and backtracking.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Build a trie from the list of words to efficiently guide the search, then perform DFS from each cell, exploring adjacent cells while marking visited cells to avoid reuse. Prune the search when the current path is not a prefix of any word in the trie, and collect words when a complete word is found.

Pro tip: Mention that you can optimize by removing words from the trie as they are found to avoid duplicate searches, and discuss the trade-off between time and space complexity.

1. Clarify the problem and constraints

Ask about grid size, word list size, word length, and whether words can be formed multiple times. Confirm that each cell can be used at most once per word.

2. Choose the right data structure

Explain that a trie (prefix tree) is ideal for storing the word list, enabling efficient prefix checks during DFS and pruning branches early.

3. Design the DFS with backtracking

For each cell, start a DFS that explores all four directions, marking cells as visited and unmarking on backtrack. At each step, check if the current path corresponds to a node in the trie.

4. Collect and deduplicate results

When a trie node marks the end of a word, add it to the result set. Optionally, remove the word from the trie to avoid finding it again from other starting cells.

5. Analyze complexity and trade-offs

Discuss time complexity: O(N * M * 4^L) worst-case without trie, but with trie it's O(N * M * 3^L) where L is max word length. Space complexity: O(total characters in words) for trie plus recursion stack.

Key Points to Mention

  • Trie (prefix tree) for efficient word lookup and pruning
  • Depth-first search (DFS) with backtracking to explore all paths
  • Visited set or in-place marking to avoid reusing cells
  • Pruning: stop exploring when current prefix is not in trie
  • Optimization: remove found words from trie to avoid duplicates
  • Complexity analysis: time and space, and trade-offs

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.