Code RoomUnsigned underflow in loop
HardPrep Room Coding #2093

Unsigned underflow in loop

Code reviewCode quality & reviewMid–Senior~16 min

Review this C++ loop meant to compare adjacent elements of a vector (it should do nothing for an empty vector).

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.

0:00 of about 16 min
Mark a line and say what kind of problem it is.0 findings
1for (size_t i = 0; i < v.size() - 1; i++) {
2 if (v[i] > v[i + 1]) report(i);
3}
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.