b*****d 发帖数: 15 | 1 You are asked to build a sum by picking one integer from each list. Find the
n largest sums amongst all the combinations of picking an integer from each
list, where n is some positive value. For example if n is 1, then you are
simply expected to find the sum that can be created by adding together the
highest integers in all the lists.
For example, given the lists:
[5,4,3,2,1]
[4,1]
[5,0,0]
[6,4,2]
[1]
and a value of 3 for n your procedure should return the sums
21 (5 + 4 + 5 + 6 + 1)
20 (4 + 4 + 5 + 6 + 1)
19 (3 + 4 + 5 + 6 + 1) |
|