Longest Common Subsequence (LCS) using Hirschberg. Linear-Space Faster Dynamic Programming Version.
Time Complexity: O(m*n) Space Complexity: O(min(m,n))
To speed up this code on DMD remove the memory allocations from lcsLengths, and do not use the retro range (replace it with foreach_reverse)
https://en.wikipedia.org/wiki/Hirschberg%27s_algorithm
http://rosettacode.org/wiki/Longest_common_subsequence#Hirschberg_algorithm_version
See Implementation
Longest Common Subsequence (LCS) using Hirschberg. Linear-Space Faster Dynamic Programming Version.
Time Complexity: O(m*n) Space Complexity: O(min(m,n))
To speed up this code on DMD remove the memory allocations from lcsLengths, and do not use the retro range (replace it with foreach_reverse)