You are given two integer arrays value and limit, both of length n.
There are n elements indexed from
You can activate available elements one by one in any order. In each step, you select an available element i and perform the following actions:
Add value[i] to the total sum.
Add element i to the set of active elements.
Let k be the total number of currently active elements. Every element j satisfying limit[j]
The process stops when there are no more available elements to activate.
Return the maximum total sum that can be obtained from an optimal activation order.
Constraints:
value.length limit.length
value[i]
limit[i]
You are given two integer arrays value and limit, both of length n.
There are n elements indexed from
You can activate available elements one by one in any order. In each step, you select an available element i and perform the following actions:
Add value[i] to the total sum.
Add element i to the set of active elements.
Let k be the total number of currently active elements. Every element j satisfying limit[j]
The process stops when there are no more available elements to activate.
Return the maximum total sum that can be obtained from an optimal activation order.
Constraints:
value.length limit.length
value[i]
limit[i]