D
D
dmr2016-06-09 21:06:58
Algorithms
dmr, 2016-06-09 21:06:58

How to find n-elements from a list that make up a given sum?

Hello.
It is required to solve a problem with the following data:

  • A list of a limited number of numbers (no more than 100), for example [102, 154, 310, 140, 250, 70, 120]
  • A number, such as 700

Based on these data, you need to find the only set of the nth number of numbers from the list, the sum of which is as close as possible to a given number or equal to it.
You need either a description of the algorithm, or, at best, a ready-made solution (preferably python).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2016-06-09
@dimonchik2013

for the smartest
, the problem in general has no solution, by the way

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question