previous
and current
, each with a length equal to the length of the shorter string plus one, filled with zeros.current[j]
to 1 + previous[j + 1]
.current[j]
to the maximum of previous[j]
and current[j + 1]
.previous
and current
arrays.previous
array after the last iteration will contain the length of the LCS.