Back to problems

Word Search in a Straight Line

Algorithm · Uber · Medium

Implement a function find_word(grid, word) that returns true if the string word can be found in the grid, and false otherwise. The grid is an m x n array of characters, and word is a string. The word must be constructed by a sequence of adjacent cells that lie in a single straight line: either horizontally, vertically, or diagonally. Once a starting cell and a direction are chosen, the path cannot change direction. Every character in the word must appear consecutively in…

Checking your access…