Skip to content

Instantly share code, notes, and snippets.

@gogogarrett
Created March 10, 2013 05:35
Show Gist options
  • Select an option

  • Save gogogarrett/5127268 to your computer and use it in GitHub Desktop.

Select an option

Save gogogarrett/5127268 to your computer and use it in GitHub Desktop.
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