I am not sure what should be the subject of this problem I have tried to put something meaningful. here is a problem:
I have an array a = [1,2,3,4,5,6]. I want to create a new array which should be something like a[n] = a[n] + a[n-1]. So for this array the result will be [1,3,6,10,15,21]. I am doing it in a very simple way by creating a new array. Is there any other tricky way of doing it? I am actually using ruby but I think it doesn't matter.