Word Search in Grid
00:00
AmazonMicrosoft
Given an m×n grid of chars and a word, return True if the word exists in the grid. Word is formed by sequentially adjacent cells (horizontally/vertically). Each cell used at most once.
Examples
Input → board=[['A','B','C','E'],['S','F','C','S'],['A','D','E','E']], word='ABCCED'
Output → True
Input → same board, word='SEE'
Output → True
Input → same board, word='ABCB'
Output → False
Note: can't reuse B