Add and Search Word Data Structure Design - C++ Solution @ LeetCode
Add And Search Word Data Structure Design, is a LeetCode problem. In this post we will see how we can solve this challenge in C++
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.
addWord("bad") addWord("dad") addWord("mad") search("pad") -> false search("bad") -> true search(".ad") -> true search("b..") - ....
You can find the full details of the problem Add and Search Word Data Structure Design at LeetCode
Solution: Please check the main.cpp snippet for the solution.
This solution originally posted at: Github by @kamyu104