NeetCode #546LC-1508MediumHeap / Priority Queue
← Back to All Problems

#546 · #1508 · Range Sum of Sorted Subarray Sums(子数组和排序后的区间和)

📌 Problem Statement & Constraints

Given an array nums of n positive integers and integers left and right, consider all n(n+1)/2 subarray sums, sort them ascending, and return the sum of the elements from index left to right (1-indexed), modulo 10^9 + 7. Constraints: 1 <= n <= 1000, 1 <= nums[i] <= 100, 1 <= left <= right <= n(n+1)/2.
🔒

Sign In to Unlock Full Solutions for All 973 Problems

Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!