Regex difference: (\w+)? and (\w*)

(\w+)? and (\w*) both match the same (0..+inf word characters) However, there is a slight difference: In the first case, if this part of the regex matches “”, the capturing group is absent. In the second case, it is empty. In some languages, the former manifests as a null while the latter should always be “”. In Javascript, for example, In PHP … Read more

What is the difference between memoization and dynamic programming?

Relevant article on Programming.Guide: Dynamic programming vs memoization vs tabulation What is difference between memoization and dynamic programming? Memoization is a term describing an optimization technique where you cache previously computed results, and return the cached result when the same computation is needed again. Dynamic programming is a technique for solving problems of recursive nature, iteratively and is … Read more