[LeetCode] 1090. Largest Values From Labels
使用 Java 爬取 LeetCode 题目内容以及提交的AC代码 传送门 Description We have a set of items: the i -th item has value values[i] and label labels[i] . Then, we choose a subset S of these items, such that: |S| <= num_wanted For every label L , the number of items in S with label L is <= use_limit . Return the largest possible sum of the subset S . Example 1: Input: values = [5,4,3,2,1], labels = [1,1,2,2,3], num_wanted = 3, use_limit = 1 Output: 9 Explanation: The subset chosen is the first, third, and fifth item. Example 2: Input: values = [5,4,3,2,1], labels = [1,3,3,3,2], num_wanted = 3, use_limit = 2 Output: