Dynamic programming HW