← All problems

Regular Expression Matching

Hard dynamic programmingstringsrecursion LeetCode ↗
Match string against pattern with '.' and '*' (zero or more of preceding).

Hints (0/3 revealed)

Log in to reveal hints progressively.

Complexity

Time O(mn), Space O(mn)

Common pitfalls

  • Greedy '*' matching (fails)
  • Exponential naive recursion

Your solution

Log in to save your code and track progress.