Code Room
Code reviewHard
Question
Review this C++ comparator that treats two prices as equal when they are within an epsilon, otherwise orders them.
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
struct Quote { double price; int id; }; bool cmp(const Quote& a, const Quote& b) { if (std::abs(a.price - b.price) < 1e-6) { return false; // "equal" -> not less } return a.price < b.price;} std::sort(quotes.begin(), quotes.end(), cmp);Run or narrate your approach, then ask the coach.