DIY: Design Add and Search Words Data Structure
Explore how to implement a wordDictionary class supporting word addition, exact and pattern-based searches, and retrieval of all stored words. Understand handling of wildcard characters in search queries and managing unique entries for efficient data operations.
We'll cover the following...
We'll cover the following...
Problem statement
Design a data structure that supports the following functions:
- Adding new words.
- Finding if a string matches any previously added string.
- Returning all the words that are present in the data structure.
Let’s call this data structure the wordDictionary class. Here is how it should be implemented:
wordDictionary(): This function will initialize the object.addWord(word): This