← Back to archive

Stdle #170 · containers · 2026-11-23

What does this C++ snippet output?

A past puzzle — fully playable. 4 attempts, hints on wrong guesses.

#include <iostream>
#include <vector>
#include <algorithm>
int main() {
std::vector<int> v = {5, 3, 8, 1};
std::cout << *std::max_element(v.begin(), v.end()) << " "
<< *std::min_element(v.begin(), v.end()) << "\n";
}
Containers
4 attempts left

Answer & explanation