Ruby - Enumerable and Collection Processing
What is the output of the following Ruby code?
arr = [[1, 2], [3, 4]]
result = arr.flat_map { |sub| sub.map { |x| x * 2 } }
puts result.inspect