Make Array Strictly Increasing
Given two integer arrays arr1 and arr2, return the minimum number of operations to make arr1 strictly increasing. In one operation, you can replace any element in arr1 with any element from arr2. If impossible, return -1.
Make Array Strictly Increasing

Given two integer arrays arr1 and arr2, return the minimum number of operations to make arr1 strictly increasing. In one operation, you can replace any element in arr1 with any element from arr2. If impossible, return -1.

Example 1:
Input: {"arr1":[1,5,3,6,7],"arr2":[1,3,2,4]}
Output: 1
Input
arr ={"arr1":[1,5,3,6,7],"arr2":[1,3,2,4]}

arr1: [1, 5, 3, 6, 7], arr2: [1, 3, 2, 4]

arr1 (target array)

1

[0]

5

[1]

3

[2]

6

[3]

7

[4]

arr2 (replacement pool, sorted)

1

2

3

4

At each position: keep arr1[i] if valid, or replace with smallest valid from arr2

Replacements:

0

Result:

?

Current

Replaced

Variables
No variables to display
DepthFunction Call
Stack empty
0/1