Tap here to switch tabs
Problem
Submissions

Problem: Apply Operations to Make Array Sum at Least k

Try to solve the Apply Operations to Make Sum of Array Greater Than or Equal to k problem.

Statement

You are given a positive integer k. You start with an array nums = [$1$].

In one operation, you can perform either of the following actions:

  1. Choose an element in nums and increment its value by 11.

  2. Select an element in nums and append a duplicate copy of it to nums.

Return the minimum number of operations required to make the sum of the elements in nums greater than or equal to k.

Constraints:

  • 1≤1 \leq k ≤105\leq 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Apply Operations to Make Array Sum at Least k

Try to solve the Apply Operations to Make Sum of Array Greater Than or Equal to k problem.

Statement

You are given a positive integer k. You start with an array nums = [$1$].

In one operation, you can perform either of the following actions:

  1. Choose an element in nums and increment its value by 11.

  2. Select an element in nums and append a duplicate copy of it to nums.

Return the minimum number of operations required to make the sum of the elements in nums greater than or equal to k.

Constraints:

  • 1≤1 \leq k ≤105\leq 10^5