Hackerrank: Grading Students Solution

Implementation

1function gradingStudents(grades) {
2 return grades.map(grade => {
3 let nextGrade = grade
4 while (++nextGrade % 5 !== 0) {}
5 return grade < 38 || nextGrade - grade >= 3 ? grade : nextGrade
6 })
7}

References

Original problem

Comments

Loading comments...

Tags

hackerrank

array

Next Post

Hackerrank: Extra Long Factorials

Basically the multiply strings problem

Previous Post

CodeWars: Human readable duration format

Readability rather than trying to be clever

HoningJS

Search Posts