Implement Array#transpose

Submitted By:
znz

Difficulty:
Medium

Tags:
arrays

Instructions:
Re-implement Ruby's Array#transpose.

Code:
class Array
  def transpose
    ___
  end
end

assert_equal [[1, 2, 3], [:a, :b, :c]].transpose, [[1, :a], [2, :b], [3, :c]]
assert_equal [[1,2], [3,4], [5,6]].transpose, [[1, 3, 5], [2, 4, 6]]
assert_equal [].transpose, []

Your Solution

Ruby 1.9.3

Back to Problems