Iterative integral versus dynamic programming