Code Room
Code reviewHard
Question
Review this C++ loop that walks a buffer backwards to find the last non-zero byte.
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
int lastNonZero(const std::vector<uint8_t>& buf) { for (size_t i = buf.size() - 1; i >= 0; --i) { if (buf[i] != 0) { return static_cast<int>(i); } } return -1;}Run or narrate your approach, then ask the coach.