211_Design_Add_and_Search_Words_Data_Structure
- Source name
- 211_Design_Add_and_Search_Words_Data_Structure.py
# File: Leetcode/Solutions/211_Design_Add_and_Search_Words_Data_Structure.py
"""
Problem Number: 211
Problem Name: Design Add and Search Words Data Structure
Difficulty: Medium
Tags: String, Depth-First Search, Design, Trie, Neetcode 150
Company (Frequency): Amazon, Apple, Facebook, Google, Microsoft
Leetcode Link: https://leetcode.com/problems/design-add-and-search-words-data-structure/description/
DESCRIPTION
Design a data structure that supports adding new words and finding if a string matches any previously added string.
Implement the `WordDictionary` class:
- `WordDictionary()` Initializes the object.
- `void addWord(String word)`: Adds `word` to the data structure, it can be matched later.
- `boolean search(String word)`: Returns `true` if there is any string in the data structure that matches `word` or `false` otherwise. A `word` may contain dots `.` where dots can be matched with any letter.
"""