GoalScope — word_search (Qwen2.5-Coder-32B-Instruct) — hover a token to see the patched verbalization
↵
<code>↵
def word_search(board, word):↵
"""Return True if the word exists in the board."""↵
def dfs(r, c, i):↵
if i == len(word):↵
return True↵
if r < 0 or c < 0 or r >= len(board) or c >= len(board[0]) or board[r][c] != word[i]:↵
return False↵
temp, board[r][c] = board[r][c], \'/\'↵
found = (dfs(r + 1, c, i + 1) or dfs(r - 1, c, i + 1) or↵
dfs(r, c + 1, i + 1) or dfs(r, c - 1, i + 1))↵
board[r][c] = temp↵
return found↵
↵
for r in range(len(board)):↵
for c in range(len(board[0])):↵
if dfs(r, c, 0):↵
return True↵
return False↵
</code>