Code Room
Code reviewMedium
Question
Review this C++ range-for that duplicates flagged items.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
#include <vector> struct Item { int id; bool flagged; }; void expand(std::vector<Item>& items) { for (const Item& it : items) { if (it.flagged) { items.push_back(Item{ it.id + 1000, false }); } }}Run or narrate your approach, then ask the coach.