Limited time: AI code review, hints, mock interviews, whiteboard analysis, and all Pro features are unlocked. Enroll

Word Search

Medium

Topics
ArrayBacktrackingMatrix

Given an m x n grid of characters board and a string word, return true if the word can be formed from sequentially adjacent (horizontally or vertically) cells, using each cell at most once.

Example 1

Input:  board = ["ABCE","SFCS","ADEE"], word = "ABCCED"
Output: true

Example 2

Input:  board = ["ABCE","SFCS","ADEE"], word = "ABCB"
Output: false

Constraints

  • 1 <= m, n <= 6
  • 1 <= word.length <= 15
Run ⌘' · Submit ⌘⏎
SensAI SensAI
Beta
Listening...
Tap mic to stop voice mode

Unlock AI Features

One click to activate - no payment, no credit card. Just sign in and you're in.

AI code review and hints
SensAI chat assistant
AI mock interviews
Whiteboard analysis
100% free during early access