C++ Missing Integer
#include <algorithm>
#include <vector>

int missingInteger(std::vector<int> a)
{
    std::sort(a.begin(), a.end());
    a.erase(std::unique(a.begin(), a.end()), a.end());

    int min = 1;
    for (int v : a) {
        if (v > 0) {
            if (min != v) {
                break;
            }
            ++min;
        }
    }

    return min;
}

This records the positive numbers that exist, then returns the smallest positive value that is still missing.