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.
Press Submit to check your solution.
Back to lesson: Practice: Practice: Counting Allocations