DIY: Regular Expression Matching

Solve the interview question "Regular Expression Matching" in this lesson.

Problem statement

Suppose you are given an input string s and a pattern p. You have to implement regular expression matching with support for “.” and “*” where:

  • '.' can match any single character. ​​​​
  • '*' can match zero or more of the preceding characters.

Note: The matching should cover the input string entirely (not partially).

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.