MCPcopy Create free account
hub / github.com/Hsinha11/Leetcode-solutions / sumRange

Method sumRange

303-Range_Sum_Query/Range_Sum_Query.py:9–10  ·  view source on GitHub ↗
(self, left: int, right: int)

Source from the content-addressed store, hash-verified

7 self.prefix_sum[i+1] = self.prefix_sum[i]+nums[i]
8
9 def sumRange(self, left: int, right: int) -> int:
10 return self.prefix_sum[right+1]-self.prefix_sum[left]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected