Code Room
Code reviewHardcr-g375
Subject LifetimesLevel Senior–Staff~22 minCommon in Code quality & review interviewsIndustries Software development

Question

Review this C++ accessor that returns a reference to the largest config value.

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.

Talk through your review
Code to reviewcpp
const std::string& maxName(const std::map<int, std::string>& m) {    return m.empty() ? std::string{} : m.rbegin()->second;} // caller:const std::string& n = maxName(cfg);use(n);
Run or narrate your approach, then ask the coach.