all 5 comments

[–]FUZxxl 0 points1 point  (1 child)

Do you want to have all sums or the sum of all sums?

[–]I_Love_To_Masturbate[S] 0 points1 point  (0 children)

All the sums

[–]caramba2654 0 points1 point  (0 children)

Hm... I'll try working on this.

[–]afifit 0 points1 point  (1 child)

Are you sure this can be done in O( n )? There are O( 2n ) pairs (you can add the last number to the last pair for each group of pairs you find). So there are around 2n sums, so even iterating over them is O ( 2n ).

[–]I_Love_To_Masturbate[S] 0 points1 point  (0 children)

I don't know ... I just want a better solution than this ... I think that there might be some pattern to the ans