Dynamic programming - subset sum problem