Make Array Strictly Increasing
HardArraySorting
Description
Given two integer arrays arr1 and arr2, you may replace elements of arr1 with any elements from arr2. Return minimum replacements to make arr1 strictly increasing.
Examples
Input:
arr1 = [1,5,3,6,7], arr2 = [1,3,2,4]Output:
1Explanation:
Array [1,5,3,6,7] has 5>3 breaking order. Replace 5 with 2 from arr2 for [1,2,3,6,7].
Input:
arr1 = [2,1,3], arr2 = [4,5,6]Output:
1Explanation:
One replacement operation makes the array strictly increasing.
Input:
arr1 = [10,20,30], arr2 = [15,25]Output:
0Explanation:
The array [10,20,30] is already strictly increasing, so no operations are needed.
Constraints
- •
1 ≤ arr1.length ≤ 2000