Problem
Fair Prize Distribution
Learn this problemProblem statement
A coding challenge has n participants. Participant i earned score points[i]. There are m available prizes, and values[j] is the value of the j-th prize.
Assign one prize value to each participant using the available prize multiset such that:
- Participants with the same score receive the same prize value.
- Participants with higher scores receive strictly higher prize values than participants with lower scores.
If multiple fair distributions are possible, return the lexicographically smallest distribution in the original participant order.
Function
findFairDistribution(points: int[], values: int[]) → int[]Examples
Example 1
points = [5,5,5]values = [2,2,2,3,3,3]return = [2,2,2]All participants have the same score, so they must receive equal prize values. [2,2,2] is lexicographically smaller than [3,3,3].
Constraints
1 <= points.length, values.length <= 2 * 10^51 <= points[i], values[i] <= 10^9
More Amazon problems
- Secure Maximum DeliveriesOA · Seen Jul 2026
- Find Median from Data StreamONSITE INTERVIEW · Seen Jul 2026
- Handwritten SigmoidPHONE SCREEN · Seen Jul 2026
- Handwritten SoftmaxPHONE SCREEN · Seen Jul 2026
- Koko Eating BananasONSITE INTERVIEW · Seen Jul 2026
- Loyal Customers Across Two DaysONSITE INTERVIEW · Seen Jul 2026
- Maximum System Memory CapacityOA · Seen Jul 2026
- Package Delivery SystemOA · Seen Jul 2026