标签:sign 查找 字符串 pad present The letters res lower
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.
Example:
addWord("bad") addWord("dad") addWord("mad") search("pad") -> false search("bad") -> true search(".ad") -> true search("b..") -> true
Note:
You may assume that all words are consist of lowercase letters a-z
.
题意:
设计一个数据结构,能够插入单词,能够查找字符串,并支持正则表达式中的“.”单字符通配。
思路:
代码:
[leetcode]211. Add and Search Word - Data structure design添加查找单词 - 数据结构设计
标签:sign 查找 字符串 pad present The letters res lower
原文地址:https://www.cnblogs.com/liuliu5151/p/9810195.html