1086. High Five
https://leetcode.com/problems/high-five
Description
Given a list of the scores of different students, items
, where items[i] = [IDi, scorei]
represents one score from a student with IDi
, calculate each student's top five average.
Return the answer as an array of pairs result
, where result[j] = [IDj, topFiveAveragej]
represents the student with IDj
and their top five average. Sort result
by IDj
in increasing order.
A student's top five average is calculated by taking the sum of their top five scores and dividing it by 5
using integer division.
Example 1:
Example 2:
Constraints:
1 <= items.length <= 1000
items[i].length == 2
1 <= IDi <= 1000
0 <= scorei <= 100
For each
IDi
, there will be at least five scores.
ac
Last updated