mercredi 27 octobre 2021

How to write function to check all combinations in a given array in C++11

I have an array of pairs containing. First number in a pair describes time it takes to do a task and second is the time before it must be done. After "using" one element it's time adds to total time. The problem is to find maximum number of elements of an array that can be used. How to check all combinations of elements and keep track of sum of time? I have done it recursively but that's messy and pretty inefficient in terms of memory.

Aucun commentaire:

Enregistrer un commentaire