You are viewing a single comment's thread. Return to all comments →
I tested my solution in VSCode and results are correct, but i cannot submit as I get message the results are wrong. Could you check please?
function gradingStudents( grades ) {
const rounded = []; const gradesOnly = [...grades]; gradesOnly.shift(); for( let grade of gradesOnly ) if( grade < 38 || grade % 5 === 0 ) rounded.push(grade); else if( Math.floor(grade / 5) * 5 + 5 - grade < 3) rounded.push(Math.floor(grade / 5) * 5 + 5); else rounded.push(grade); return rounded; }
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Grading Students
You are viewing a single comment's thread. Return to all comments →
I tested my solution in VSCode and results are correct, but i cannot submit as I get message the results are wrong. Could you check please?
function gradingStudents( grades ) {
const rounded = []; const gradesOnly = [...grades]; gradesOnly.shift(); for( let grade of gradesOnly ) if( grade < 38 || grade % 5 === 0 ) rounded.push(grade); else if( Math.floor(grade / 5) * 5 + 5 - grade < 3) rounded.push(Math.floor(grade / 5) * 5 + 5); else rounded.push(grade); return rounded;
}