Best possible combination sum of predefined numbers that smaller or equal NN
问题 I have a list of lengths for pipes and I need fit these lengths within maximum allowed length for the best yield For example the max allowed length is 90 and the pieces I need to make are: 25, 60, 13, 48, 23, 29, 27, 22 For the best fit within 90 I'd have a group of these numbers: 60, 29 (89 total) 27, 25, 13, 23 (88 total) 48, 22 (70 total) I found this answer to similar question, but I don't know how to convert it to use in excel or javascript or php Any help would be appreciated. Thank you