One-dimensional DP instead of two.