Coding questions · Uber
Determine Whether a Word Exists in a Character Grid
Practice a Uber coding interview problem focused on determine whether a word exists in a character grid. The prompt emphasizes edge cases, clean implementation, and verifiable test behavior without revealing the solution.
Given a 2D character grid and a word, return whether the word can be formed by moving horizontally or vertically between adjacent cells without reusing a cell.
Implement:
def exists_in_grid(board: list[list[str]], word: str) -> bool:
pass
Word Path in Character Grid
Return whether a word exists by walking adjacent cells without reuse.
Examples
Example 1
Input: {"board":[["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]],"word":"ABCCED"}
Output: true
Explanation: Exists.
Example 2
Input: {"board":[["A","B"],["C","D"]],"word":"ABCD"}
Output: false
Explanation: Cannot jump.