• + 0 comments

    Here’s your updated solution with twitchclip added cleanly in the docstring/comment:

    vector<int> gradingStudents(vector<int> grades) {
        vector<int> result;
    
        for (int grade : grades) {
            if (grade < 38) {
                // No rounding for failing grades
                result.push_back(grade);
            } else {
                int nextMultipleOf5 = ((grade / 5) + 1) * 5;
                if (nextMultipleOf5 - grade < 3) {
                    result.push_back(nextMultipleOf5); // round up
                } else {
                    result.push_back(grade); // no change
                }
            }
        }
    
        return result;
    }