Given an elevator with max weight and n people with x_i weights, find out minimum number of rides needed

Viewed 3519
input:
max_weight = 550
n = 4
x_i = [120, 175, 250, 150]

output:
2  
// [[250, 175, 120], [150]]

My initial impression is that this looks very similar to a dynamic programming coin change/knapsack problem, however it is not coin change (which would be asking for the fewest number of weights to make an exact amount), and it is not knapsack (the weights do not have values and it's like I can have more than 1 knapsack).

Is there a common name/solution for this problem?

3 Answers
Related