DEVSTR - Editorial

Hi,

can anybody explain a DP solution for this problem?