You are given two integer arrays values and labels of length numWanted and useLimit. The value and label of the item at index values[i] and labels[i], respectively.
Find the maximum possible sum of values from a subset of items such that:
The subset contains at most numWanted items.
For each label, the subset contains at most useLimit items with that label.
Return the maximum sum that can be obtained.
Constraints:
n == values.length == labels.length
values[i], labels[i]
numWanted, useLimit
You are given two integer arrays values and labels of length numWanted and useLimit. The value and label of the item at index values[i] and labels[i], respectively.
Find the maximum possible sum of values from a subset of items such that:
The subset contains at most numWanted items.
For each label, the subset contains at most useLimit items with that label.
Return the maximum sum that can be obtained.
Constraints:
n == values.length == labels.length
values[i], labels[i]
numWanted, useLimit