Ctrl K

Raise It Into a Strict Climb

Easy
You are given an integer array steps. One step adds 1 to any element. Return the fewest steps after which the array is **strictly increasing**, meaning each element is greater than the one before it. A single-element array already counts as strictly increasing.
Example 1
steps=[3, 3, 2] → 4

Raise the second value to 4 (1 step) and the third to 5 (3 steps): [3, 4, 5] in 4 steps.

Example 2
steps=[2, 9, 4, 4] → 13

The target is [2, 9, 10, 11]: 6 + 7 = 13 steps.

Example 3
steps=[7] → 0
Constraints
  • 1 ≤ len(steps) ≤ 5000
  • 1 ≤ steps[i] ≤ 10⁴
Have you seen this problem in a real interview?
Solved by0
Tried by0
Submissions0
Acceptance—
Topics
Similar problemsCake Slices for Guests EasyStrength of the Weaker Partner EasyPlanting Along a Garden Row EasyMaking Change at the Kiosk EasyRise and Fall Lineup Easy
loading Python…
Input
steps=[3, 3, 2]
Expected
4

Run checks the first 3 tests in your browser. Submit checks all 116 tests on the server, hidden ones included.