(self, array: list[int])
| 9 | |
| 10 | class PrefixSum: |
| 11 | def __init__(self, array: list[int]) -> None: |
| 12 | len_array = len(array) |
| 13 | self.prefix_sum = [0] * len_array |
| 14 | |
| 15 | if len_array > 0: |
| 16 | self.prefix_sum[0] = array[0] |
| 17 | |
| 18 | for i in range(1, len_array): |
| 19 | self.prefix_sum[i] = self.prefix_sum[i - 1] + array[i] |
| 20 | |
| 21 | def get_sum(self, start: int, end: int) -> int: |
| 22 | """ |
nothing calls this directly
no outgoing calls
no test coverage detected