1
class NumArray:
2

3
def __init__(self, nums: List[int]):
4
self.nums, Sum = [], 0
5
for num in nums:
6
Sum += num
7
self.nums.append(Sum)
8

9
def sumRange(self, left: int, right: int) -> int:
10
return (
11
self.nums[right] - self.nums[left - 1]
12
if left - 1 >= 0
13
else self.nums[right]
14
)

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0