Tap here to switch tabs
Problem
Submissions

Problem: Maximum Total Reward Using Operations I

Try to solve the Maximum Total Reward Using Operations I problem.

Statement

You are given an integer array rewardValues, representing the values of rewards.

Initially, your total reward x is 00, and all indices in the array are unmarked. You can perform the following operation any number of times:

  • Choose an unmarked index i such that rewardValues[i] is strictly greater than your current total reward x.

  • Add rewardValues[i] to x and mark the index i.

Return the maximum total reward you can collect by performing these operations optimally.

Constraints:

  • 1≤1 \leq rewardValues.length ≤2000\leq 2000

  • 1≤1 \leq rewardValues[i] ≤2000\leq 2000

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Maximum Total Reward Using Operations I

Try to solve the Maximum Total Reward Using Operations I problem.

Statement

You are given an integer array rewardValues, representing the values of rewards.

Initially, your total reward x is 00, and all indices in the array are unmarked. You can perform the following operation any number of times:

  • Choose an unmarked index i such that rewardValues[i] is strictly greater than your current total reward x.

  • Add rewardValues[i] to x and mark the index i.

Return the maximum total reward you can collect by performing these operations optimally.

Constraints:

  • 1≤1 \leq rewardValues.length ≤2000\leq 2000

  • 1≤1 \leq rewardValues[i] ≤2000\leq 2000