First exposure to Dynamic programming (opens in new tab)
I tried solving Leetcode problem #10( Regular Expression Matching) for fun, ended up spending hours on it. problem Link: I took a naive greedy string construction approach to check if the string s matched the pattern p. That worked for simple cases where: p="a*b" s="aaab" output:True But failed in cases where p ="ab*a*c*a" and s ="aaa", output should be True why greedy string construction failed: the flaw was that a* is not a single choice, it can match "", "a", "aa", "aaa" etc. To determine ...
Read the original article