* Robert Klemme <shortcutter / googlemail.com> (2009-10-25) schrieb:

> buckets = Hash.new 0
>
> nums.each do |x|
>   buckets[x - x % 10] += 1
> end

Why not just

buckets = num.inject([]) do | a, x |
  i = x.div 10
  a[i] = a.fetch(i, 0) + 1
  a
end

mfg,                  simon .... l