Skip to content

Instantly share code, notes, and snippets.

@schauhan232
Created July 6, 2021 09:59
Show Gist options
  • Save schauhan232/6391821abfcf670de761dc404212ff90 to your computer and use it in GitHub Desktop.
Save schauhan232/6391821abfcf670de761dc404212ff90 to your computer and use it in GitHub Desktop.
HackerRank Grading Students
/*
* Complete the 'gradingStudents' function below.
*
* The function is expected to return an INTEGER_ARRAY.
* The function accepts INTEGER_ARRAY grades as parameter.
*/
public static List<int> gradingStudents(List<int> grades)
{
return grades.Select(grade=>{
if(grade %5 < 3 || grade < 38){
return grade;
}
return grade + (5 - grade %5);
}).ToList();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment