Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
The k smallest numbers that do not appear in nums will result in the minimum sum.
Recall that the sum of the first n positive numbers is equal to n * (n+1) / 2.
Initialize the answer as the sum of 1 to k. Then, adjust the answer depending on the values in nums.