aboutsummaryrefslogtreecommitdiff
path: root/challenge-283/deadmarshal/ruby/ch2.rb
blob: 4d711245f8a70004d312f2a2c401ed986d9b5787 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/env ruby

def digit_count_value(arr)
  h = Hash.new(0)
  arr.each{|e| h[e] += 1}
  i = 0
  arr.all?{|e| h[i] == e && i += 1}
end

puts digit_count_value([1,2,1,0])
puts digit_count_value([0,3,0])