Dashboard
LC #10
Regular Expression Matching
Pattern · ?MetaGoogleBloomberg
Problem
Implement regex matching with '.' (matches any single character) and '*' (matches zero or more of the preceding element).
Constraints
- 1 ≤ s.length ≤ 20
- 1 ≤ p.length ≤ 30
- s contains only lowercase letters
- p contains lowercase letters, ".", and "*"
Example
- Input
- s = "aa", p = "a*"
- Output
- true
- Why
- "a*" means zero or more "a"s, which matches "aa"
Spot the pattern
Which pattern cracks it?
Hints
One at a time