leetcode-5445- 子数组和排序后的区间和
2021-04-19 21:27
标签:range col solution info 图片 ges elf ima mic 题目描述: 提交: leetcode-5445- 子数组和排序后的区间和 标签:range col solution info 图片 ges elf ima mic 原文地址:https://www.cnblogs.com/oldby/p/13287781.htmlclass Solution:
def rangeSum(self, nums: List[int], n: int, left: int, right: int) -> int:
l = []
for i in range(n):
for j in range(i+1,n+1):
l.append(sum(nums[i:j]))
l.sort()
print(l)
return sum(l[left-1:right]) % (10**9 + 7)