Tap here to switch tabs
Problem
Submissions

Problem: Make Array Strictly Increasing

Make Array Strictly Increasing asks you to make one array strictly increasing by replacing selected values with elements from a second array, minimizing operations or returning -1 if impossible.

Statement

Given two integer arrays arr1 and arr2, return the minimum number of operations needed to make arr1 strictly increasing.

In one operation, you can choose any element in arr1 and replace it with any element from arr2.

If it is impossible to make arr1 strictly increasing, return −1-1.

Constraints:

  • 1≤arr1.length,arr2.length≤20001 \leq \text{arr1.length}, \text{arr2.length} \leq 2000

  • 0≤arr1[i],arr2[i]≤1090 \leq \text{arr1[i]}, \text{arr2[i]} \leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Make Array Strictly Increasing

Make Array Strictly Increasing asks you to make one array strictly increasing by replacing selected values with elements from a second array, minimizing operations or returning -1 if impossible.

Statement

Given two integer arrays arr1 and arr2, return the minimum number of operations needed to make arr1 strictly increasing.

In one operation, you can choose any element in arr1 and replace it with any element from arr2.

If it is impossible to make arr1 strictly increasing, return −1-1.

Constraints:

  • 1≤arr1.length,arr2.length≤20001 \leq \text{arr1.length}, \text{arr2.length} \leq 2000

  • 0≤arr1[i],arr2[i]≤1090 \leq \text{arr1[i]}, \text{arr2[i]} \leq 10^9