← Back to archive

Stdle #133 · containers · 2026-10-17

What does this C++ snippet output?

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

#include <iostream>
#include <vector>
int main() {
std::vector<int> v = {1, 2, 3, 4};
v.insert(v.begin() + 2, 99);
for (int x : v) std::cout << x << " ";
std::cout << "\n";
}
Containers
4 attempts left

Answer & explanation