#3180

Maximum Total Reward Using Operations I

expert · 1115 · lc medium +32 · 30.7% accepted · 212 likes · top 8%

Description

Given an integer array rewardValues, start with total x = 0 and all indices unmarked. You may repeatedly pick any unmarked index i and, if rewardValues[i] > x, add it to x and mark i. Return the maximum total reward achievable.

Code

1
2
3