Add Dynamic programming