The bottom-right DP cell answers the original optimization problem. It uses every item and the full capacity. This lesson reads that cell as the exact maximum achievable value.

highlighted = computed this step

Final cell

The final cell is dp at all items and full capacity, with value 9. Why: that state is exactly the original problem.

dp[4,7]=9dp[4,7]=9
Final DP valueThe highlighted final cell is the exact maximum value.Optimal value01234567cap-00000000(1,1)01111111(3,4)01145555(4,5)01145669(5,7)01145789resultleave (skip item i)take (item i)

Maximum value

No feasible subset can exceed value 9. Why: the recurrence has already compared every take-or-leave decision.

optimal value 9\text{optimal value }9
Final DP valueThe highlighted final cell is the exact maximum value.Optimal value01234567cap-00000000(1,1)01111111(3,4)01145555(4,5)01145669(5,7)01145789resultleave (skip item i)take (item i)

Diagram note

The highlighted cell is recomputed from the same DP table as every other entry. Pixel positions are rounded for layout; every number shown is exact.

bottom-right cell is the optimum value\text{bottom-right cell is the optimum value}
Final DP valueThe highlighted final cell is the exact maximum value.Optimal value01234567cap-00000000(1,1)01111111(3,4)01145555(4,5)01145669(5,7)01145789resultleave (skip item i)take (item i)