7 kyu
Consecutive Differences
512 of 827coder334
Description:
Given a list of integers, find the positive difference between each consecutive pair of numbers, and put this into a new list of differences. Then, find the differences between consecutive pairs in this new list, and repeat until the list has a length of 1
. Then, return the single value.
The list will only contain integers, and will not be empty.
For example:
differences([1, 2, 3]) => [1, 1] => [0] => 0
differences([1, 5, 2, 7, 8, 9, 0]) => [4, 3, 5, 1, 1, 9] => [1, 2, 4, 0, 8] => ... => 1
differences([2, 3, 1]) => [1, 2] => 1
Algorithms
Similar Kata:
Stats:
Created | Jan 3, 2021 |
Published | Jan 3, 2021 |
Warriors Trained | 1391 |
Total Skips | 22 |
Total Code Submissions | 2755 |
Total Times Completed | 827 |
Python Completions | 512 |
Haskell Completions | 49 |
JavaScript Completions | 295 |
Total Stars | 23 |
% of votes with a positive feedback rating | 91% of 193 |
Total "Very Satisfied" Votes | 162 |
Total "Somewhat Satisfied" Votes | 28 |
Total "Not Satisfied" Votes | 3 |
Total Rank Assessments | 6 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 8 kyu |