I have two nested arrays with equal size:
Array1 =[[1, 2], [], [2, 3]]
Array2= [[1, 4], [8, 11], [3, 6]]
I need to merge them in one array, like this:
Array = [[1,2,1,4], [8,11], [2,3,3,6]],
so each elements of new Array[x] = Array1[x] + Array2[x]
I understand how to do it with for(each)
cycle, but I am sure Ruby has an elegant solution for that. It is also possible that the solution will produce by changing Array1
.