Search
⌘K

Leetcode 1187. Make Array Strictly Increasing

Given arr1 and arr2, find the minimum number of replacements (each replacement sets arr1[i] to any value from arr2) required to make arr1 strictly increasing, or return -1 if impossible. This is typically solved with dynamic programming that tracks feasible "previous" values at each position (using sorted/unique arr2 + binary search to choose replacements efficiently).


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.