Given an input string s and a pattern p, implement regular expression matching with support for '.' and '*' where: '.' Matches any single character. '*' Matches zero or more of the preceding element. The matching should cover the entire input string (not partial).
30:00
Java
Regular Expression Matching
hard
Topics
Companies
Given an input string s and a pattern p, implement regular expression matching with support for '.' and '' where: '.' Matches any single character. '' Matches zero or more of the preceding element. The matching should cover the entire input string (not partial).
Example 1:
Input: {"s":"aa","p":"a*"}
Output: true
Constraints:
1≤s.length≤20
1≤p.length≤20
s consists of lowercase English letters.
p consists of lowercase English letters, '.', and '*'.
It is guaranteed that for each *, there will be a valid preceding character.