#Dynamic Programming Change the signs: how to use dynamic programming to solve a competitive programming question