Z49

Word Search II (Trie + Backtracking)

Staff / Principal Engineer
Target Time: 40 - 50 Minutes
Type: ARRAY

Problem Statement & Objective

Given an m x n board of characters and a list of strings words, return all words on the board.

Function Signature (Python)

word_search_ii_trie_backtracking(board: list[list[str]], words: list[str]) -> list[str]

Input & Output Contract

Output Rule:Bulunan benzersiz kelimelerin alfabetik sıralı listesi.

System Constraints

m == tahta.length, n == tahta[i].length
1 <= m, n <= 12
1 <= kelimeler.length <= 3 * 10^4
1 <= kelimeler[i].length <= 10

Example Execution Walkthrough

tahta = [['o','a','a','n'],['e','t','a','e'],['i','h','k','r'],['i','f','l','v']], kelimeler = ['oath','pea','eat','rain']
cevap: ['eat', 'oath']

Example Test Scenarios (3)

Example 1
Input:[[["o","a","a","n"],["e","t","a","e"],["i","h","k","r"],["i","f","l","v"]],["oath","pea","eat","rain"]]
Expected Output:["eat","oath"]
Example 2: Çözüm Yok
Input:[[["a","b"],["c","d"]],["abcb"]]
Expected Output:[]
Example 3: Tek Hücre
Input:[[["a"]],["a"]]
Expected Output:["a"]
Loading Python Editor...
Input Parameters
[
  [
    [
      "o",
      "a",
      "a",
      "n"
    ],
    [
      "e",
      "t",
      "a",
      "e"
    ],
    [
      "i",
      "h",
      "k",
      "r"
    ],
    [
      "i",
      "f",
      "l",
      "v"
    ]
  ],
  [
    "oath",
    "pea",
    "eat",
    "rain"
  ]
]
Expected Output
[
  "eat",
  "oath"
]