Regular Expression Matching - Swift Solution @ LeetCode
Regular Expression Matching, is a LeetCode problem from dynamic-programming subdomain. In this post we will see how we can solve this challenge in Swift
You can find the full details of the problem Regular Expression Matching at LeetCode
Note: A simple recursion violates the time limit. We need to first simplify the pattern in the following ways:
1. a*a* -> a* merge identical "x*"s 2. a*b*.*c*d* -> .* ignore all the "x*"s before and after ".*"
Time Complexity: O(n), Space Complexity: O(n)
Please check the main.swift snippet for the solution.
This solution originally posted at: Github by @soapyigu