Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#include <vector>
/* Complete the function so that it calculates the sum of the
unique values in the given sequence.
i.e. if the sequence was 1, 2, 3, 2, 4, 2
then the unique values would be 1, 2, 3, 4
the sum of these unique values would be 10
Make use of the EXISTING features of the STL, it is possible
to solve this entirely using existing functions.
The algorithms library in particular may be helpful
https://en.cppreference.com/w/cpp/algorithm
*/
int sum_uniques( std::vector<int>::iterator begin,
std::vector<int>::iterator end )
{
}