Say I have an array of integers like so:
I'd like to find all combinations of these values that when summed exceed the maximum (in this case
10) by the smallest amount (in this case a number that is closest to
The function for this array would output
[[9,2], [6,5], [7,2,2], ... etc]. If for example there is no possible combination that would make
11 it would try
12 and so on.
This is not from an online course. I'm working on a hotel booking website. I have multiple rooms in the hotel, and I need to find all possible combinations for large groups. Imagine the array contains the amount of rooms by their capacity (2 x 2 beds, 1 x 3 beds, 5 x 5 beds etc...) and then I need to find all possible combinations of hotel rooms for eg. a conference of 37 people.