Get Relative Ratings (Fungible :)

Problem Overview

  • Compute each player's relative rating: the maximum sum of ratings from at most k players whose skill is less than that player's skill.
  • Input: skill[n], rating[n], and k; Output: long int[n] with each player's relative rating.
  • Constraints: n ≤ 2e5, 0 ≤ k ≤ n−1, skill[i], rating[i] ≤ 1e9.
  • Real-world context: rating system in an Amazon game based on relative skill and absolute ratings.
  • Asked in Amazon interviews; a coding interview problem and common interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: