Dashboard
LC #212

Word Search II

Pattern · ?AmazonGoogleMeta

Problem

Find all words from a dictionary that exist in a 2D board where letters must be adjacent (no reuse).

Constraints

  • 1 ≤ m, n ≤ 12
  • 1 ≤ words.length ≤ 3 × 10⁴
  • 1 ≤ words[i].length ≤ 10
  • Lowercase English letters only

Example

Input
board=[["o","a","a","n"],["e","t","a","e"],["i","h","k","r"],["i","f","l","v"]], words=["oath","pea","eat","rain"]
Output
["eat","oath"]
Why
"eat" found; "oath" found. "pea" and "rain" cannot be formed on the board

Spot the pattern

Which pattern cracks it?

Hints

One at a time
Solve on LeetCode ↗