Get Max Reward Points

Problem Overview

  • Given rewards for n items, find the maximum total points by choosing a purchase order where each buy reduces all remaining rewards by 1 (not below 0), and each item can be bought once.
  • Input: int array reward[n] (0 ≤ reward[i] ≤ 1e6, 1 ≤ n ≤ 1e5); Output: long_int maximum reward points.
  • Context: Amazon shopping offers with diminishing rewards after each purchase.
  • From 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: