Skip to content
Quiz · Algorithms and Complexity · lesson 4 of 9

Quiz — a comparator for sort

What does the program print?

C++
#include <algorithm>
#include <iostream>
#include <vector>

int main() {
    std::vector<int> v{2, 3, 1, 3};
    std::sort(v.begin(), v.end(), [](int a, int b) { return a > b; });
    for (int x : v) {
        std::cout << x << ' ';
    }
}