Given an m x n grid of letters board and a string word, return true if word can be found in the grid.
The word has to be spelled out along a path of cells, where each cell is next to the one before it: directly up, down, left or right of it, not diagonal. A cell can't be used more than once in the same word.
Letters are case-sensitive, so "a" and "A" are different letters.
Examples
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
Start at the S at the end of the middle row, go down to the E below it, then left to the next E.
Example 3
Input: board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "ABCB"
Output: false
Example 4
Input: board = [["a","b"],["c","d"]], word = "abcd"
Output: false
b and c only touch at a corner, and diagonal steps aren't allowed.
Example 5
Input: board = [["a","b"],["c","d"]], word = "abdc"
Output: true
Go right from a to b, down to d, then left to c.
Constraints
m == board.lengthn == board[i].length1 <= m, n <= 61 <= word.length <= 15boardandwordcontain only lowercase and uppercase English letters.
Follow-up
Can you skip searches that are sure to fail, so that it still runs fast on a bigger board?