G
G
gloribus2017-02-28 00:07:24
PHP
gloribus, 2017-02-28 00:07:24

How to select numbers from an array that add up to a given number?

Good day. There is an array, for example from 100 float numbers. There are N = 164.3
It is necessary to select all the numbers from the array so that the sum of these numbers = is N or slightly more. Use no more than 15 numbers from the array.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vaut, 2017-02-28
@vaut

The classic task of packing a backpack. There is nothing much better than overkill.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question