Finding max, min, mode
Here are some things that may help you improve your code.

Use direct initialization

In the first line, we have this:

std::vector &lt;int&gt; v = { 2, // ...


However, this may be shortened slightly by simply omitting the =:

std::vector &lt;int&gt; v{ 2, // ...


This is list initialization which was standardized in C++11.

Use "range-for" to simplify the loop

Instead of using this somewhat complicated for loop:

for (int i = 1, countMode = 1, count = 1; i &lt; v.size(); ++i) {


You could instead use a range-for:

for (const auto n : v) {


Avoid doing needless calculations

By definition, in a sorted list the first number will be min and the last max, so there's not much point in making those calculations.

Use better naming

Variables min and max are good because they give a good clue as to what they hold.  However, number might be better called prev since it's the previous number in the sorted list.

Here's one way to do all of that:

int max = v.back();
int min = v.front();
int prev = max;
int mode;
int maxcount = 0;
int currcount = 0;
for (const auto n : v) {
    if (n == prev) {
        ++currcount;
        if (currcount &gt; maxcount) {
            maxcount = currcount;
            mode = n;
        }
    } else {
        currcount = 1;
    }
    prev = n;
}