DIY: Design Add and Search Words Data Structure
Explore how to design and implement a WordDictionary class in Kotlin that allows you to add words, search strings including wildcards, and retrieve all stored words. This lesson develops your ability to structure data and apply search techniques relevant to coding interviews.
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.void addWord(word): This