18/01/16 23:50:04.19 1yOH1J8J.net
94 の続きに、以下を付け足して
results = groups.each_with_object({}) do |(num, ary), h|
scores.each_with_index do |num2, i|
if num == num2
if h[num]
h[num] <<= i
else
h[num] = [i]
end
end
end
end
p results
出力
{2=>[1, 3, 9], 3=>[4, 7, 8]}