algorythms
Dynamic Programming
LC #44Hard

Wildcard Matching

Dynamic Programming
AmazonGoogleMetaBloomberg

Problem

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

dynamic-programmingstringgreedy

Constraints

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

Example

Inputs = "adceb", p = "*a*b"
Outputtrue
Why

"*" matches "", "a" matches "a", "*" matches "dce", "b" matches "b"

Hints — reveal one at a time