bugl
bugl
HomeLearnPatternsPathsSearchPremium
HomeLearnPatternsPaths
Hard2-D Dynamic ProgrammingLC 10

Regular Expression Matching

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).

Asked at 23 companies
AdobeAirbnbAlibaba
Hints
  • 1.Think about what data structure fits Regular Expression Matching
  • 2.Consider the brute force complexity and how to optimize
  • 3.Can you trade space for time?
LeetCodeNeetCode