Skip to main content
PreparationZone Logo
PreparationZone
Back to Coding

Coding · Medium · Pro

Trie search with '.' wildcard matching any letter

CodingTrieSenior
Model answerPreview

Approach

  • DFS on trie nodes; on '.', try all children.
  • On letter, follow single child.
  • At end of word require isEnd.

Java Solution

Java
public class WildcardTrie {
    public boolean search(TrieNode node, String word, int i)…