← All mock interviewsHints used: 0
Word Search Mock Interview
- ✓Problem→
- 2Clarifying Questions→
- 3Constraints→
- 4Brute Force→
- 5Complexity Analysis→
- 6Pattern Recognition→
- 7Optimized Solution→
- 8Implementation→
- 9Testing→
- 10Follow-Up→
- 11Evaluation
Problem
Given an m × n grid of characters board and a string word, return true if word can be constructed from letters of sequentially adjacent cells. Adjacent cells are horizontal or vertical neighbours, and the same cell may not be used more than once in a single word.
Constraints
- 1 ≤ m, n ≤ 6
- 1 ≤ word.length ≤ 15
- board and word consist of lowercase and uppercase English letters
Example
in: board = [["A","B","C","E"],["S","F","C","S"],["A","D","E","E"]], word = "ABCCED"
out: true
Clarify
Before choosing anything: what would you ask the interviewer? What assumptions are you making? (Duplicates? Empty input? Value ranges? What to return when there is no answer?)