Tap here to switch tabs
Problem
Submissions

Problem: Minimum Numbers of Function Calls to Make Target Array

med
30 min
Try to solve the Minimum Numbers of Function Calls to Make Target Array problem.

Statement

You are given an integer array nums. Initially, you have an array arr of the same length where every element is set to 00.

In one operation, you can apply either of the following function calls:

  1. Increment by 11: Choose any index i and increase the value of arr[i] by 11.

  2. Multiply by 22: Multiply every element in the entire array arr by 22.

Return the minimum number of function calls required to make arr equal to nums.

Constraints:

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

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

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Numbers of Function Calls to Make Target Array

med
30 min
Try to solve the Minimum Numbers of Function Calls to Make Target Array problem.

Statement

You are given an integer array nums. Initially, you have an array arr of the same length where every element is set to 00.

In one operation, you can apply either of the following function calls:

  1. Increment by 11: Choose any index i and increase the value of arr[i] by 11.

  2. Multiply by 22: Multiply every element in the entire array arr by 22.

Return the minimum number of function calls required to make arr equal to nums.

Constraints:

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

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