Word Search Board

Given a 2D board and a word, find if the word exists in the grid.

The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically neighboring. The cell itself does not count as an adjacent cell.
The same letter cell may be used more than once.

Example :

Given board =

word = "ABCCED", -> returns 1,
word = "SEE", -> returns 1,
word = "ABCB", -> returns 1,
word = "ABFSAB" -> returns 1
word = "ABCD" -> returns 0

Note that 1 corresponds to true, and 0 corresponds to false.

Interview Code Editor
  • Solution Approach
  • Complete Solution
1889 successful submissions.
Asked In:
  • Epic systems
  • Amazon
Click here to jump start your coding interview preparation