Your question is Word Search in 2D Matrix. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
The Fanatics app represents a compact merchandising or personalization surface as a 2D grid of characters. Given a character grid and a target word, determine whether the word can be formed by moving between horizontally or vertically adjacent cells.
Each cell may be used at most once in a single word path. The word must use consecutive characters in order, and diagonal movement is not allowed.
Implement word_exists(board, word).
board is a non-empty rectangular list of lists of single-character strings.word is a string containing one or more characters.True if word can be formed under the movement rules; otherwise return False.def word_exists(board, word):