Skip to content

Practice Maximum Total Reward Using Operations I

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Medium#3180
LeetCode Problem

Maximum Total Reward Using Operations I

Problem Statement

Given rewardValues, start with total reward 0 and all indices unmarked. You may choose an unmarked index only when its value is strictly greater than the current total. Add that value to the total and mark the index. Return the largest total obtainable after any number of operations.

Source: Maximum Total Reward Using Operations I on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
rewardValues = [1,1,3,3]
Output
4

# Example 2

Input
rewardValues = [1,6,4,3,2]
Output
11

Constraints

1 <= rewardValues.length <= 2000
1 <= rewardValues[i] <= 2000

Related LeetCode Problems

Practice more problems similar to Maximum Total Reward Using Operations I.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.