Problem
Given a grid of letters board (a list of rows, each a list of single characters) and a word, return whether the word can be traced in the grid. You trace by starting on any cell and moving one step up, down, left or right for each next letter. A cell cannot be used twice in the same word.
Example 1
board = [["A","B","C","E"],
Example 2
["S","F","C","S"],
Example 3
["A","D","E","E"]]
Example 4
- Input
- word = "ABCCED"
- Output
- True
Example 5
- Input
- word = "SEE"
- Output
- True
Example 6
- Input
- word = "ABCB"
- Output
- False
- Why
- would need to reuse the B
Constraints
1 <= rows, cols <= 61 <= word.length <= 15board and word contain only upper and lower case English letters.