. . . "This algorithm is an application of mathematical dynamic programming. (do not ask me.)" .