Given an m x n grid of characters board and a string word, determine whether word can be constructed from sequentially adjacent cells.
Rules:
board
: 2D array of characters
word
: target string
true
if
word
exists in the grid by the rules above, else
false
.
board = [[A,B,C,E],[S,F,C,S],[A,D,E,E]], word = "ABCCED" → true
1 ≤ m, n ≤ 12
1 ≤ |word| ≤ m*n