#3181

Maximum Total Reward Using Operations II

international master · 2175 · lc hard +32 · 21.9% accepted · 133 likes · top 2%

Description

Given an integer array rewardValues, start with total x = 0. Repeatedly pick any unmarked index i where rewardValues[i] > x, add it to x, and mark i. Return the maximum total reward (larger-constraint version).

Code

1
2
3