Back to problems

Search Words in a Character Grid

Algorithm · Glean · Hard

You are given a rectangular board of lowercase English letters laid out in m rows and n columns. A word is spelled by picking a starting cell and then repeatedly moving to a horizontally or vertically neighboring cell — diagonal steps are not allowed. Along any one word's path a cell may contribute its letter at most once, but the moment the search retreats from a cell that cell becomes usable again for other paths. Part 1 — a single word. Given a string word, decide whether…

Checking your access…