Word Search
Difficulty: Medium
Acceptance: %
Points: 30.00
Given a 2D grid of letters and a target word, determine if the word can be formed by sequentially connecting letters in adjacent cells. The word can only be constructed by using horizontal or vertical neighboring cells, and each cell can be used at most once.
Your task is to implement the function isWordExist(), which takes a 2D board and a word as input parameters. The function should return true if the word can be formed from the board, and false otherwise.
Expected Time Complexity: O(N * M * 4^L) where N = No. of rows in board, M = No. of columns in board, L = Length of word
Expected Space Compelxity: O(L), L is length of word.