802. Wildcard Matching (Recursive + Memo)

HardRecursionRecursion

Given s and pattern p with '?' (single char) and '*' (any sequence including empty), return true if p matches entire s. Implement with recursion + memoization.

Input: Two quoted strings.

Output: Boolean.

Examples

Example 1
Input: "adceb", "*a*b"
Output: true
Explanation: * matches empty, a matches a, * matches dce, b matches b.
Example 2
Input: "acdcb", "a*c?b"
Output: false
Explanation: No valid matching.

Constraints

Asked by

BloombergMicrosoftGoogleInfosysAmazonMeta
Solve this problem in the editor →