[Routine] DP, a very tricky problem