arr
.reduce({}){|acc, n| acc.update(n[:books])}
.collect{|k, v| { author: k, book: v[:book] }}
.sort_by{|n| n[:author]}
a.map.with_index{|n, i| n.merge(b[i]).merge(c[i])}
(a + b + c).group_by{|n| n[:year]}.map{|i, n| n.reduce({}, :merge)}
goods.each.with_index do |n, i|
puts n + " " + prices[i].to_s
end
print goods.zip(prices).map{|n| n.join(" ")}.join("\n")
(1..height_result - 1).each do |n|
space_count = (height.to_i - n).abs
asterisk_count = height_result - space_count * 2 - 1
print " " * space_count + "*" * asterisk_count + "\n"
end
a = [
{:car=>["BMW", "Mersedes", "Audi"]},
{:car=>["Renault", "Ferrari", "Nissan"]},
{:car=>["VW"]},
{:country=>["Russia", "Japan", "USA"]},
{:country=>["China", "Nigeria", "Egypt"]},
{:city=>["Moscow", "Tokyo", "Amsterdam"]}
]
b = a.group_by{|n| n.keys[0]}.map{|k, n| {k => n.map{|m| m[k]}}}