Search⌘ K
AI Features

Solution: High Five

Understand how to use hash maps to store and manage student scores efficiently. Learn to sort and calculate the top five average scores per student, optimizing for time and space complexity in C++. This lesson prepares you to implement practical solutions for coding interview problems.

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] ...