← Uber Interview Insights

Uber·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

Phone screen for a SWE role at Uber, one coding problem, pretty standard grid stuff but the follow-ups are where it gets interesting. Felt manageable if you've done any word search problems before, but don't sleep on the variations.

Questions Asked (1)

Q1

Given a 2D character grid and a target word, determine whether the word appears along any single straight line in 8 directions (horizontal, vertical, or diagonal). No turning allowed.

Algorithms & Data Structures
Author's notes

My first instinct was to reach for DFS and backtracking, which would've been completely wrong here.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Treat the grid as a graph where each cell is a potential starting point. For each cell that matches the first character of the word, explore all 8 directions, checking if the subsequent characters match along that straight line. If any direction yields a full match, return true; otherwise, continue until all cells are exhausted.

Pro tip: Clarify edge cases upfront, such as empty word, word longer than grid dimensions, and whether the word can be found in reverse. Also, discuss time and space complexity trade-offs, and mention that early termination when the remaining path is too short can optimize performance.

1. Clarify requirements and edge cases

Confirm the definition of 'straight line' (8 directions), whether the word can be read forwards only or also backwards, and handle empty word or grid. Discuss constraints like grid size and word length.

2. Define directions and helper function

List the 8 direction vectors (dx, dy). Write a helper function that, given a starting cell and a direction, checks if the word matches along that line without turning.

3. Iterate over all cells

Loop through each cell in the grid. If the cell matches the first character of the word, try all 8 directions using the helper function. If any direction returns true, the word exists.

4. Optimize with pruning

Before exploring a direction, check if the word can fit within the grid boundaries from the starting cell in that direction. Skip directions where the remaining length exceeds the available cells.

5. Analyze complexity and discuss trade-offs

State time complexity O(N * M * 8 * L) where N, M are grid dimensions and L is word length, and space complexity O(1) excluding input. Mention that early termination and pruning can improve practical performance.

Key Points to Mention

  • 8-directional search: horizontal, vertical, and both diagonals
  • No turning allowed: each direction check is a straight line
  • Starting point selection: only cells matching the first character
  • Boundary checks to avoid index out of bounds
  • Time complexity: O(N * M * 8 * L) and space complexity O(1)
  • Edge cases: empty word, word longer than grid, single character word

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