straightforward we initialize an ( ( arraylfor the boundary cases when or namelywe initialize [ for - , , and [ for - , , (this is slight abuse of notationsince in realitywe would have to index the rows and columns of starting with thenwe iteratively build up values in until we have [ ]the length of longest common subsequence of and we give pseudo-code description of how this approach results in dynamic programming solution to the longest common subsequence (lcsproblem in code fragment code fragment dynamic programming algorithm for the lcs problem performance the running time of the algorithm of code fragment is easy to analyzefor it is dominated by two nested for loopswith the outer one iterating times and the inner one iterating times since the if-statement and assignment inside the loop each requires ( primitive operationsthis algorithm runs in (nmtime thusthe dynamic programming technique can be applied to the longest common subsequence problem to improve significantly over the exponential-time bruteforce solution to the lcs problem algorithm lcs (code fragment computes the length of the longest common subsequence (stored in [ , ])but not the subsequence itself as shown in the following propositiona simple postprocessing step can extract the longest common subsequence from the array returned by algorithm