DevHireLab
TutorialsBootcamp
Problems
Code SimulatorAI InterviewSoonContact
DevHireLab
TutorialsBootcamp
Problems
Code SimulatorAI InterviewSoonContact
Back to Arena
hard
Trie

Word Search II

**Problem Statement:** Given the required input arguments, write an efficient algorithm to solve the **Word Search II** problem. Implement the required logic as specified by standard definitions for this classic algorithmic challenge. **Hint / Expected Approach:** DFS on board + Trie for multi-word pruning **Edge Cases to Consider:** - (1) No word found - (2) Same word multiple times - (3) Board smaller than words

Examples

Example 1
Input: [["o","a","a","n"],["e","t","a","e"],["i","h","k","r"],["i","f","l","v"]], ["oath","pea","eat","rain"]
Output: ["eat","oath"]
Explanation: Classic
Example 2
Input: [["a","b"],["c","d"]], ["abdc"]
Output: ["abdc"]
Explanation: Path a→b→d→c
Example 3
Input: [["a"]], ["a"]
Output: ["a"]
Explanation: Single cell

Constraints

  • ▪Input arguments are within valid ranges
  • ▪Optimize for execution speed
  • ▪Handle null/empty inputs gracefully

Watch Out For Edge Cases

  • ▪No word found
  • ▪Same word multiple times
  • ▪Board smaller than words
Frequently Asked At
AmazonGoogleMicrosoftMeta