6 kyu
Urban Dictionary
1,537 of 2,178joh_pot
Description:
Design a data structure that supports the following two operations:
addWord
/add_word
which adds a word,search
which searches a literal word or a regular expression string containing lowercase letters"a-z"
or"."
where"."
can represent any letter. Return true if the search term fully matches any word previously added; otherwise, return false.
You may assume that all given words contain only lowercase letters.
Examples
addWord("bad")
addWord("dad")
addWord("mad")
search("pad") === false
search("bad") === true
search(".ad") === true
search("b..") === true
Note: the data structure will be initialized multiple times during the tests!
Algorithms
Object-oriented Programming
Similar Kata:
Stats:
Created | Oct 29, 2015 |
Published | Oct 29, 2015 |
Warriors Trained | 4139 |
Total Skips | 57 |
Total Code Submissions | 10980 |
Total Times Completed | 2178 |
JavaScript Completions | 1537 |
Python Completions | 582 |
Ruby Completions | 96 |
Total Stars | 86 |
% of votes with a positive feedback rating | 90% of 255 |
Total "Very Satisfied" Votes | 214 |
Total "Somewhat Satisfied" Votes | 30 |
Total "Not Satisfied" Votes | 11 |