You are given two integer arrays nums and threshold, both of length n.
Starting at step =
Choose any unvisited index i such that threshold[i] \leq step.
Add nums[i] to the total sum and mark index i as visited.
Advance to step +
If at any step no unvisited index i satisfies threshold[i] \leq step, the process terminates immediately. The process also terminates if all
Return the maximum total sum that can be achieved.
Constraints:
$n ==$ nums.length threshold.length
nums[i]
threshold[i]
You are given two integer arrays nums and threshold, both of length n.
Starting at step =
Choose any unvisited index i such that threshold[i] \leq step.
Add nums[i] to the total sum and mark index i as visited.
Advance to step +
If at any step no unvisited index i satisfies threshold[i] \leq step, the process terminates immediately. The process also terminates if all
Return the maximum total sum that can be achieved.
Constraints:
$n ==$ nums.length threshold.length
nums[i]
threshold[i]