The output is the minimum cost, not the "path"

The path is simple as well, just trace back from the end to the origin, by finding the minimum previous step

PS: interestingly, if diagonal (to down-right) move is allow, the algorithm for the path is the standard Dynamic Time Warping (the input is the table of item-wise distance)