Or you can work from the back which leaves you the general subproblem form of finding the best alignment of the prefix 1...i of D1 with the prefix 1...j of D2.
Option 1: The general subproblem is to find the cost of the best solution from post i to post n. The answer for the original problem is when i=1.
Option 2: The general subproblem is to find the cost of the best solution from post 1 to post i. The answer for the original problem is when i=n.
Option 3: The general subproblem is to find the cost of the best solution from post i to post n where you cannot exchange your canoe until at least post j. The answer to the original problem is when i=1 and j=2.
Option 4: The general subproblem is to find the cost of the best solution from post 1 to post i where the latest post when you can exchange your canoe is post j. The answer to the original problem is when i=n and j=n-1.
Option 1: The general subproblem is to determine if x[i],...,x[m] and y[j],....,y[n] can interleave to form z[i+j],...,z[n+m]. The answer to the original problem is when i=1 and j=1.
Option 2: The general subproblem is to determine if x[1],...,x[i] and y[1],....,y[j] can interleave to form z[i],...,z[i+j]. The answer to the original problem is when i=m and j=n.