Given an m x n grid of characters and a word, determine whether the word can be constructed from a path of adjacent cells, moving up, down, left or right, without reusing the same cell more than once.
board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "ABCCED"trueboard = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "ABCB"falseSolve it in the editor. Sign in free to run your Python or JavaScript against test cases, get a verdict, and track your attempts.
Solve on FeatCode →Explore a decision one choice at a time, undo it if it doesn't lead anywhere, and try the next option. It's a systematic way to generate every valid combination, permutation, or arrangement.
Read the full Backtracking guide →
Original problem on LeetCode ↗