← 返回 snowflake 的题目列表Word Search
类型:qbank
Given a 2-D grid of characters board and a string word, return true if the word is present in the grid, otherwise return false.
Word Search
Given a 2-D grid of characters board and a string word, return true if the word is present in the grid, otherwise return false.
SWE
grid
backtracking
dfs
medium
Frequency
Single report
Last asked
2026-01-30
Stage
phone-screen · onsite-coding
Word Search
The Challenge
You are provided with a 2-D grid of characters called board and a specific string called word. Your task is to determine if the word exists inside the grid. If it does, return true. If not, return false.
To find the word, follow these rules:
You can form the word by connecting letters that are next to each other (horizontally or vertically).
You cannot use the exact same cell position more than once for the same word.
Sample Cases
Case 1:
Input: board = [ ["A","B","C","D"], ["S","A","A","T"], ["A","C","A","E"] ], word = "CAT"
Output: true
Case 2:
Input: board = [ ["A","B","C","D"], ["S","A","A","T"], ["A","C","A","E"] ], word = "BAT"
Output: false
Technical Limitations
The size of the board (rows and columns) is small: between 1 and 5.
The length of the word is between 1 and 10 characters.
Both the board and the word contain only standard English letters (lowercase and uppercase).