Skip to main content

Practice · 1 of 1

Reserve Then Build

CHALLENGE
Difficulty: advanced+25 XP

Implement squares so it produces n values 1..n into the output vector using **at most one allocation**: reserve the exact capacity before writing. push_back in a loop after reserving is fine.

Back to lesson: Practice: Practice: Counting Allocations