medium

Word Search

Given a grid of letters and a word, determine whether the word can be spelled by a path of horizontally or vertically adjacent cells, using each cell at most once.

Constraints
  • 1 ≤ m, n ≤ 6
  • 1 ≤ word.length ≤ 15
  • Letters only
Examples
in: board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "ABCCED"
out: true

Code it yourself

Solve in
Test execution is not yet available for this exercise.Practice journal →Draft saved in this browser.
Hints:
Which approach applies?

Choose an approach to check your pattern recognition, or reveal the discussion when you need help.