← Back to archive

Stdle #97 · containers · 2026-09-11

What does this C++ snippet output?

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

#include <iostream>
#include <map>
int main() {
std::map<int,int> m = {{1,1},{2,2},{3,3}};
m.erase(2);
std::cout << m.count(2) << " " << m.size() << "\n";
}
Containers
4 attempts left

Answer & explanation