Solved LeetCode program · 79 of 1,000
#0079 · Word Search
Original English source
Keep a shared board holding 65, 66, 67, 69, 83, 70, 67, 83, 65, 68, 69, and 69. Keep a shared word as empty text. Place "ABCCED" into word. Keep a shared visited as an empty list of whole numbers.
For every cell from 0 to 11.
Place 0 into visited.
Keep a shared found of 0.
To search from row (a whole number) at column (a whole number) with index (a whole number). If found is 1, return. If row is less than 0 or row is more than 2 or column is less than 0 or column is more than 3, return. If item (row times 4 plus column) of visited is 1, return. If item (row times 4 plus column) of board is not character index of word, return. If index is 3, set found to 1, return. Set item (row times 4 plus column) of visited to 1. If found is 0, search from row plus 1 at column with index plus 1. If found is 0, search from row minus 1 at column with index plus 1. If found is 0, search from row at column plus 1 with index plus 1. If found is 0, search from row at column minus 1 with index plus 1. Set item (row times 4 plus column) of visited to 0.
Search from 0 at 0 with 0. If found is 1, display true. Otherwise, display false.
Expected stdout
true