3684. Maximize Sum of At Most K Distinct Elements
You are given a positive integer array
numsand an integerk.Choose at most
kelements fromnumsso that their sum is maximized. However, the chosen numbers must be distinct.Return an array containing the chosen numbers in strictly descending order.
1 | class Solution { |