Created
March 10, 2013 05:35
-
-
Save gogogarrett/5127268 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def heavy_decimal_count(a, b) | |
| total = 0 | |
| (a..b).each do |value| | |
| values = value.to_s.split('') | |
| array_size = values.size | |
| if (values.map(&:to_i).inject{|sum,n| sum += n }.to_f / array_size.to_f) > 7.0 | |
| total += 1 | |
| end | |
| end | |
| total | |
| end | |
| heavy_decimal_count(8675, 8689) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment