add_and_search_word_data_structure_design

package
v1.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2019 License: MIT Imports: 0 Imported by: 0

README

< Previous                  Next >

211. Add and Search Word - Data structure design (Medium)

Design a data structure that supports the following two operations:

void addWord(word)
bool search(word)

search(word) can search a literal word or a regular expression string containing only letters a-z or .. A . means it can represent any one letter.

Example:

addWord("bad")
addWord("dad")
addWord("mad")
search("pad") -> false
search("bad") -> true
search(".ad") -> true
search("b..") -> true

Note:
You may assume that all words are consist of lowercase letters a-z.

[Design] [Trie] [Backtracking]

Similar Questions

  1. Implement Trie (Prefix Tree) (Medium)
  2. Prefix and Suffix Search (Hard)

Hints

Hint 1 You should be familiar with how a Trie works. If not, please work on this problem: Implement Trie (Prefix Tree) first.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL