Medium

Quiz

#79 Word Search

APPROACH

Return true if string word can be formed by a path of sequentially adjacent (horizontally or vertically neighboring) cells in the m x n character grid board, where no cell may be reused.

Example 1:

Input: board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "ABCCED"
Output: true

Example 2:

Input: board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "SEE"
Output: true

Example 3:

Input: board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "ABCB"
Output: false
1 of 4
1:00

What is the optimal approach for this problem?