Word Search II
Find every dictionary word on a letter board by walking the board and a trie together.
The problem
Implement Solution.findWords(board, words). board is a grid of lowercase letters and words is a list of words. You can form a word by starting at any cell and moving up, down, left or right to the next letter, without using the same cell twice in that word. Return every word from words that can be formed, each word once, in any order. The board has 1 to 12 rows and 1 to 12 columns. There are up to 30,000 words, and each word has 1 to 10 letters.
Starter code
class Solution:
def findWords(self, board, words):
passPublic examples
board = [["o", "a", "a", "n"], ["e", "t", "a", "e"], ["i", "h", "k", "r"], ["i", "f", "l", "v"]], words = ["oath", "pea", "eat", "rain"]gives["oath", "eat"]board = [["d", "o", "g"]], words = ["do", "dog", "dot"]gives["do", "dog"]board = [["q", "a", "b"]], words = ["ab", "ba"]gives["ab", "ba"]
Solving it in the practice book needs an active paid plan.
Open it in the practice bookOne thought at a time.
