← 返回 amazon 的题目列表Regular Expression Matching
类型:online_judge
Problem: Regular Expression Matching
Given a string s and a pattern p, implement regular expression matching with support for . and *.
Rules:
. matches any single character.
* matches zero or more occurrences of the preceding element.
The match must cover the entire string s, not just a substring.
Return true or false indicating whether p fully matches s.
Input Format
s
p
Output Format
true or false
Constraints
0 <= len(s) <= 20
1 <= len(p) <= 30
s contains only lowercase English letters
p contains only lowercase English letters, . and *
Every * has a valid preceding element
Example
Input:
aa
a*
Output:
true
Example
Input
aa
a
Output
false