674 - Dynamic programming