Search
⌘K

Leetcode 1589. Maximum Sum Obtained of Any Permutation

Given nums and many inclusive range requests, permute nums to maximize the total sum of all requested subarray sums; the core idea is to compute how often each index is covered (via a difference/prefix technique) and greedily assign largest numbers to indices with highest coverage, returning the result mod 1e9+7.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Your account is free and you can post anonymously if you choose.