You have items with the given weights and values and a bag that holds at most capacity in total weight. Each item can be taken at most once.
Return the indices of the items in one best packing, in increasing order. The total value of the items you return must be the largest value achievable, and their total weight must not exceed the capacity.
- If several packings reach the best value, any of them is accepted
- Return
[] when nothing fits or nothing has a positive value - All weights are positive integers
- Build the full table, then walk back to recover the items