Will not run out of the boundary when building the DP table