You are given a template in which you need to implement a function whose signature is given below.
int findWordInAGrid(char grid, int m, int n, char word)
/* return 0 for false, 1 for true. */
bool findWordInAGrid(char grid, int m, int n, char word)
static boolean findWordInAGrid(char grid, int m, int n, String word)
grid represents the characters that are in the given grid. Only the first m rows and the first n columns should be considered relevant. word is the word whose occurance has to be found in the grid. Remember, word may start from any location in the grid. word will never contain more than 30 characters. Return true if word is found in the grid, false otherwise.
The function should return true, if you can find the word in the grid and false otherwise.
Let's consider the grid given below:
a b c
d e f
g h i
And set of words to be searched are:
The output of the above example should be:
1 ≤ m,n ≤ 100