Implement regular expression matching with support for . and *.
. Matches any single character. * Matches zero or more of the preceding element.
Input: s = "aa", p = "a"
Output: false
Input: s = "aa", p = "a*"
Output: true
Input: s = "ab", p = ".*"
Output: true
Input: s = "aab", p = "c*a*b"
Output: true
Runner expects two lines on stdin: first line is the input string s, second line is the pattern p. Program must print true or false (or True/False for Python) exactly as the final output so it's comparable.
No submissions yet.
Common approaches: recursion + memoization (top-down DP), bottom-up DP. Watch edge cases with '*' matching zero occurrences.