Skip to content

Latest commit

 

History

History
48 lines (26 loc) · 712 Bytes

File metadata and controls

48 lines (26 loc) · 712 Bytes

Problem 10: Regular Expression Matching

Difficulty: Hard

Problem

Given an input string (s) and a pattern (p), implement regular expression matching with support for '.' and '*'.

'.' Matches any single character.
'*' Matches zero or more of the preceding element.

The matching should cover the entire input string (not partial).

Note:

s could be empty and contains only lowercase letters a-z. p could be empty and contains only lowercase letters a-z, and characters like . or *.

Example

Input:

s = "aa"

p = "a"

Output: false

Explanation: "a" does not match the entire string "aa".

Input:

s = "mississippi"

p = "mis*is*p*."

Output: false