NewThe Learning module is now liveSee what's new

(This question is a variation of the LeetCode question 44. Wildcard Matching. If you haven't completed that question yet, it is recommended to solve it first.)

Given a list of distinct words wordDict and a pattern string, return all words in wordDict that match the pattern. A pattern is matched from left to right using three rules:

  • A lowercase letter matches only the identical letter in the word.
  • '?' matches exactly one character.
  • '.' matches one or more consecutive characters. It must consume at least one character.
Test Cases
Input
Output
Expected