1class Solution:2 def countRangeSum(self, nums: List[int], lower: int, upper: int) -> int:3 acc = list(accumulate(nums))4 ans = a = 05 for n in nums:6 a += n7 ans += sum(1 for x in acc if lower <= x <= upper)8 acc.pop(0)9 lower += n10 upper += n11 return ans
WPM •0 •0
ACC •0 •0
TIME •0