10. Regular Expression Matching
Practice Regular Expression Matching for free on NudgeCode: Hard, Dynamic Programming pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.
Return whether pattern p matches the whole string s. The pattern uses lowercase letters plus two special characters: . matches any single character, and * means zero or more copies of the character right before it. The match must cover all of s, not just part of it.
Example
s = "aa", p = "a" -> false
s = "aa", p = "a*" -> true
s = "ab", p = ".*" -> true
Constraints
- 1 <= s.length <= 20
- 1 <= p.length <= 20
sis lowercase English letters;pis lowercase letters,.and*- Every
*has a letter or.right before it