Company: Cisco_3sep
Difficulty: medium
Word Search in a 2D Grid Problem Description You're developing the core algorithm for a next-generation word puzzle game that combines elements of Scrabble and Boggle. The game is played on a large grid where players must find words from a massive dictionary. The challenge is to, given a 2D grid of characters and a dictionary of words, find all words from the dictionary that can be formed in the grid. A word can be formed by a sequence of adjacent letters in the grid. The rules are as follows: Adjacent cells are connected in 8 directions (horizontally, vertically, and diagonally). The same letter cell may not be used more than once in a single word. Examples Example 1: Input: board = [['o','a','a','n'],['e','t','a','e'],['i','h','k','r'],['i','f','l','v']] dictionary = ["oath","pea","eat","rain","oat","cat","oath","hike","kite"] Output: ["eat","oath","oat"] Explanation: - "oath": o(0,0) -> a(0,1) -> t(1,1) -> h(2,1) - "eat": e(1,0) -> a(0,1) -> t(1,1) - "oat": o(0,0) -> a(0,1) -> t(1,1