Quote:

I need to have a vector given 20 integers, smallest to largest, and then remove the items in the vector in the fewest possible steps by using the following process:

An element X in the data set can be removed along with X – 1 or X + 1 if they are present in the set. After each deletion, print the values remaining in the data set.

Well the smallest X will be encountered first if they are in fact arranged smallest to largest. If the position of X is p then if *(p+1) == X+1 AND *(p+2) == X+2, then you can call erase(p, p+3); on the vector and proceed from there. If the test fails, you'll have to make the next X, *(p+1), the new X.