7 kyu
Simple Fun #67: Array Change
229 of 494myjinxin2015
Description:
Task
You are given an array of integers. On each move you are allowed to increase exactly one of its element by one. Find the minimal number of moves required to obtain a strictly increasing sequence from the input.
Example
For arr = [1, 1, 1]
, the output should be 3
.
Input/Output
[input]
integer arrayarr
Constraints:
3 ≤ inputArray.length ≤ 100,
-10000 ≤ inputArray[i] ≤ 10000.
[output]
an integerThe minimal number of moves needed to obtain a strictly increasing sequence from inputArray.
It's guaranteed that for the given test cases the answer always fits signed 32-bit integer type.
Puzzles
Similar Kata:
Stats:
Created | Feb 3, 2017 |
Published | Feb 3, 2017 |
Warriors Trained | 1033 |
Total Skips | 12 |
Total Code Submissions | 1109 |
Total Times Completed | 494 |
JavaScript Completions | 211 |
C# Completions | 72 |
Python Completions | 229 |
Ruby Completions | 35 |
Total Stars | 15 |
% of votes with a positive feedback rating | 92% of 146 |
Total "Very Satisfied" Votes | 127 |
Total "Somewhat Satisfied" Votes | 15 |
Total "Not Satisfied" Votes | 4 |
Total Rank Assessments | 10 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 7 kyu |
Lowest Assessed Rank | 7 kyu |