Sum it up algo++

if i take the test case as
7
10 1 2 7 6 1 5
8

some of the answers gets repeated.

There will be some duplicate elements in this solution because you cannot remvoe those elements. But in the final answer you can remove the duplicates.

https://ide.codingblocks.com/s/290998 I have coded the function SumitUp. See lines 36-38 for removing duplicates.

can you explain line 38?

ans.resize(distance(ans.begin(), it));
It is a way to remove the empty spaces from the vector.