Check if a word is present in boggle game 2D array

O(N^2 + (M-1)* 3^2) solution, where N is number of rows & cols in 2D
matrix AND M is number of letters in input string.
- N^2  => for the first letter search in the matrix
- (M-1) * 3^2 => for remaining letters search in the adjacent places in
matrix