Build the PrimitiveMedium
Word Search
Write `exist(board, word)` returning `True` when the word can be spelt by walking adjacent cells (up, down, left, right) without reusing a cell.
The whole problem is the visited bookkeeping. Overwrite the cell with a sentinel before recursing and put the character back afterwards — that is O(1) per step and leaves the board exactly as you found it. Allocating a fresh visited set per path is correct and much slower.
What to expect: A timer starts when you begin. Edit the starter code, run it against the test suite as many times as you like, then finish when you're done. The reference solution and interviewer follow-up questions unlock only after you finish.