Tap here to switch tabs
Problem
Submissions

Problem: Append K Integers With Minimal Sum

Append K Integers With Minimal Sum asks you to choose k unique positive integers absent from an array and return their minimum possible sum.

Statement

You are given an integer array nums and an integer k. Append k unique positive integers that do not appear in nums such that the sum of the appended integers is minimized.

Return the sum of the k integers appended to nums.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤109\leq 10^9

  • 1≤1 \leq k ≤108\leq 10^8

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Append K Integers With Minimal Sum

Append K Integers With Minimal Sum asks you to choose k unique positive integers absent from an array and return their minimum possible sum.

Statement

You are given an integer array nums and an integer k. Append k unique positive integers that do not appear in nums such that the sum of the appended integers is minimized.

Return the sum of the k integers appended to nums.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 1≤1 \leq nums[i] ≤109\leq 10^9

  • 1≤1 \leq k ≤108\leq 10^8