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: false
Explanation: The pattern "a" matches exactly one 'a', but the string has two, so the whole string is not matched.
Example 2
Input: s = aa, p = a*
Output: true
Explanation: '*' lets the preceding 'a' repeat any number of times, so "a*" can match "aa".
Example 3
Input: s = ab, p = .*
Output: true
Explanation: ".*" means any character, repeated any number of times, so it matches "ab" (or any other string).
dp[i][j] is whether s[:i] matches p[:j]. A '*' either drops the preceding pattern element (zero copies) or, if that element matches s[i-1], consumes one more character of s.
Run checks all cases above. Submit evaluates all test cases.