7 kyu
Digits Average
839 of 1,595marbiru
Description:
Given a non-negative integer, take the (mean) average of each pair of consecutive digits. Repeat this process until you have a single integer, then return that integer. e.g.
Note: if the average of two digits is not an integer, round the result up (e.g. the average of 8 and 9 will be 9)
Examples
Integer 246 ==> Should return 4
original: 2 4 6
\ / \ /
1st iter: 3 5
\ /
2nd iter: 4
Integer 89 ==> Should return 9
original: 8 9
\ /
1st iter: 9
p.s. for a bigger challenge, check out the one line version of this kata by myjinxin2015!
Algorithms
Similar Kata:
Stats:
Created | Dec 14, 2017 |
Published | Dec 14, 2017 |
Warriors Trained | 3371 |
Total Skips | 61 |
Total Code Submissions | 7831 |
Total Times Completed | 1595 |
JavaScript Completions | 839 |
Python Completions | 562 |
Groovy Completions | 29 |
Kotlin Completions | 130 |
Ruby Completions | 68 |
Haskell Completions | 43 |
Total Stars | 41 |
% of votes with a positive feedback rating | 94% of 386 |
Total "Very Satisfied" Votes | 342 |
Total "Somewhat Satisfied" Votes | 39 |
Total "Not Satisfied" Votes | 5 |
Total Rank Assessments | 4 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 7 kyu |
Lowest Assessed Rank | 8 kyu |