I need to create a method whose arguments are an array of subarrays that are of equal size and a shift value. The output needs to be a new array where the shifted values add up to each other.
Example
array[[1,2,3,4,5,6],[7,8,9,10,11,12],[13,14,15,16,17,18]]
shift_value = 4
#shift explained below
[1,2,3,4,5,6]
[7,8,9,10,11,12]
[13,14,15,16,17,18]
#desired output
[1,2,10,12,27,30,26,28,17,18]
Is there a method in ruby to do this? I spent some time making loops finding the index numbers that need to be added and forming a new array, but got lost.