Code Room
Vibe codingHardvc-g085
Subject Ai prompt iterationLevel Senior–Staff~22 minCommon in Algorithms & data structures interviewsIndustries Computer games, Software development

Question

You ask an AI to optimize a C++ hot loop that processes 10M particles per frame. First pass it 'optimizes' by replacing your `std::vector` with `std::list` ('faster insertion'); frame time gets worse. You say slower; it adds `#pragma omp parallel for` over a loop with a shared accumulator — now it's a data race and the output flickers. It's confidently making it worse each turn. How do you recognize the model lacks the real bottleneck and reset?

What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it — tests, edge cases, reading critically — and how you’d re-prompt or decompose to get it right.

Describe your solution

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.