Dashboard
LC #44

Wildcard Matching

Pattern · ?AmazonGoogleMetaBloomberg

Problem

Implement wildcard pattern matching with '?' (any single character) and '*' (any sequence including empty).

Constraints

  • 0 ≤ s.length ≤ 2000
  • 0 ≤ p.length ≤ 2000
  • s contains only lowercase letters
  • p contains lowercase letters, '?', and '*'

Example

Input
s = "adceb", p = "*a*b"
Output
true
Why
"*" matches "", "a" matches "a", "*" matches "dce", "b" matches "b"

Spot the pattern

Which pattern cracks it?

Hints

One at a time
Solve on LeetCode ↗