• + 0 comments

    Here's the C++ solution:

    vector<int> gradingStudents(vector<int> grades) {
        for(int  i=0; i<grades.size(); i++){  
            int dif = 5-grades[i]%5;
            if(grades[i] >= 38 && dif < 3)
                grades[i] += dif;
        }
        return grades;
    }