Question: def wildcard _ search ( self , pattern: str ) - > list: Searches for words in the Trie that match a
def wildcardsearchself pattern: str list:
Searches for words in the Trie that match a given pattern including wildcards.
The wildcard matches any sequence of characters including an empty sequence
and matches any single character.
:param pattern: The pattern to search for, which may include and wildcards.
:return: List of strings; all words in the Trie that match the given wildcard pattern.
:complexity: OP K where P is the length of the pattern and K is the number of matching words.
Example:
If the Trie contains 'apple', 'app', 'apricot', 'banana':
wildcardsearchap should return app 'apple', 'apricot'
wildcardsearchale should return apple
please use in python
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
