258. Wildcard Matching

HardStringString

Given an input string s and a pattern p, return true if p matches the entire string. '?' matches any single character; '*' matches any sequence of characters (including empty). Input: '"s", "p"'.

Input: '"s", "p"'.

Output: Boolean — true or false.

Examples

Example 1
Input: "aa", "a"
Output: false
Explanation: 'a' does not match 'aa'.
Example 2
Input: "aa", "*"
Output: true
Explanation: '*' matches everything.
Example 3
Input: "adceb", "*a*b"
Output: true
Explanation: Stars absorb other chars.

Constraints

Asked by

BloombergMicrosoftGoogleInfosysAmazonMeta
Solve this problem in the editor →