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

More By Author:

Check out these other kata created by marbiru

Stats:

CreatedDec 14, 2017
PublishedDec 14, 2017
Warriors Trained3371
Total Skips61
Total Code Submissions7831
Total Times Completed1595
JavaScript Completions839
Python Completions562
Groovy Completions29
Kotlin Completions130
Ruby Completions68
Haskell Completions43
Total Stars41
% of votes with a positive feedback rating94% of 386
Total "Very Satisfied" Votes342
Total "Somewhat Satisfied" Votes39
Total "Not Satisfied" Votes5
Total Rank Assessments4
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • marbiru Avatar
  • anter69 Avatar
  • myjinxin2015 Avatar
  • romerojp Avatar
  • Madjosz Avatar
  • kdmatrosov Avatar
  • cliffstamp Avatar
  • Just4FunCoder Avatar
  • saudiGuy Avatar
Ad