I have the following problem:
You are given N counters, initially set to 0, and you have two possible operations on them:
Ruby 100%
def solution(n, a) max = 0 offsets = a.inject(Hash.new(max)) do |acc, el| next Hash.new(max) if el == n+1 acc[el] +=1 max = acc[el] if max < acc[el] acc end (1..n).map{|i| offsets[i]} end