130. Wildcard Matching

Hard · String

Implement a wildcard pattern matcher. You're given a string s and a pattern p, where p may contain special characters: '?' matches any single character, and '*' matches any sequence of characters (including an empty sequence). Return true if the pattern matches the entire string s, and false otherwise. The input is an array [s, p] where both s and p are strings.

Examples

Example 1
Input: ["aa","a"]
Output: false
Explanation: "a" does not cover both characters of "aa"
Example 2
Input: ["aa","*"]
Output: true
Explanation: "*" matches everything

Constraints