← Uber Interview Insights

Uber·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

Phone screen for a software engineer role at Uber. Just one coding problem, Word Search.

Questions Asked (1)

Q1

Implement a Word Search algorithm: given a 2D grid of characters, determine whether a given word exists in the grid by searching horizontally, vertically, or diagonally through adjacent cells.

Algorithms & Data Structures
Author's notes

Classic backtracking problem.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the problem constraints (e.g., whether diagonal moves are allowed, if cells can be reused, and grid dimensions) before diving into the algorithm. Then, propose a depth-first search (DFS) with backtracking from each cell, exploring all 8 directions (or 4 if diagonals are excluded) to match the word character by character. Discuss time and space complexity, and consider optimizations like early termination or pruning.

Pro tip: Mention that you would handle edge cases such as an empty grid, word longer than total cells, or repeated characters, and discuss how to avoid revisiting cells (e.g., marking visited cells temporarily). This shows attention to detail and robustness, which is highly valued at Uber.

1. Clarify requirements and constraints

Ask about grid dimensions, allowed directions (horizontal, vertical, diagonal), whether cells can be reused, and if the word can be empty. Confirm input types and expected output.

2. Outline the approach

Explain that you will iterate over each cell as a starting point and perform DFS/backtracking to match the word. Mention that you will explore all valid directions from each cell.

3. Detail the DFS/backtracking logic

Describe how to recursively check the next character in each direction, marking cells as visited to avoid reuse, and unmarking them upon backtracking. Include base cases for success and failure.

4. Analyze complexity and optimizations

State the time complexity (O(N * M * 8^L) where L is word length) and space complexity (O(L) for recursion stack). Discuss potential optimizations like early exit if the first character doesn't match or using a trie for multiple words.

5. Test with examples and edge cases

Walk through a small example, including edge cases like word not present, single-cell grid, or word with repeated characters. Verify the algorithm handles them correctly.

Key Points to Mention

  • Depth-first search (DFS) with backtracking to explore all possible paths.
  • Handling of 8 directions (or 4 if diagonals are excluded) and boundary checks.
  • Marking visited cells to prevent reuse within a single path, and unmarking after backtracking.
  • Time complexity analysis: O(N * M * 8^L) where N, M are grid dimensions and L is word length.
  • Space complexity: O(L) due to recursion stack, plus any additional space for visited tracking.
  • Edge cases: empty grid, word longer than total cells, word with repeated characters, and single-character word.

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