We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Grading Students
Grading Students
Sort by
recency
|
3994 Discussions
|
Please Login in order to post a comment
Here is my c++ solution, you can find video here : https://youtu.be/fYcSakw_5-M
Python solution:
def gradingStudents(grades):
**java **
public static List gradingStudents(List grades) { // Write your code here for(int i=0;i37){ int num=grades.get(i)%10; int newnum=(grades.get(i)/10)*10; if(num<5 && num>2){ grades.set(i, newnum+5); } if(num>5 && num>7){ grades.set(i, newnum+10); } } } return grades; }
My Solution in JavaScript / TypeScript
function gradingStudents(grades: number[ ]): number[ ] {
}
My solution in Scala:
def gradingStudents(grades: Array[Int]): Array[Int] = { grades.map(number => { if (number < 38) { number } else { val nextMultipleOf5 = ((number / 5) + 1) * 5 if (nextMultipleOf5 - number < 3) nextMultipleOf5 else number }}) }