I want to achieve the below via recursion:
[1,2,3,4,5]
first iteration => 1 + 2
second iteration => 1+ 3
third iteration => 1+4
fourth iteration =>1+5
fifth iteration => 1+2+3
sixth iteration => 1+2+4
seventh iteration =>1+2+5
eigth iteration => 1+2+3+4
ninth iteration => 1+2+3+5
but I do not know if there is a good way provided in Ruby to do this. Kindly assist please.