I have an array:
x = [1,2,3,4,5]
I want to get:
output = [1,2,6,24,120]
Hope you see the pattern and what I want to accomplish here. x[1] is
transformed into x[1]*x[0]. x[2] => x[2]*x[1]*x[0], etc.
What’s the most efficient way to do this in Ruby?
You can use e.g. the following code