High Five

Try to solve the High Five problem.

Statement

You are given a list of scores for multiple students, represented as items, where items[i]=[IDi,scorei]items[i] = [ID_i, score_i] indicates the ID of a student (IDi)(ID_i) and their score (scorei)(score_i). Your task is to compute the top five average scores for each student.

Return the result as an array of pairs, result, where result[j]=[IDj,topFiveAveragej]result[j] = [ID_j, topFiveAverage_j] represents the student with ID, IDjID_j, and their corresponding top five average scores. The result should be sorted in ascending order by IDjID_j.

Note: To calculate the top five averages for each student, sum their highest five scores and perform integer division by 55.


Constraints:

  • 1<=1 <= items.length <=1000<= 1000

  • items[i].length ==2== 2

  • 1<=IDi<=10001 <= ID_i <= 1000

  • 0<=scorei<=1000 <= score_i <= 100

  • For each IDiID_i, there will be at least five scores.

Examples

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.