Implement prototype(values: list[int], queries: list[tuple[int, int]]) -> list[int] and solve with the same signature. Each query (left, right) requests the sum of [left, right). Return integer results in query order; values may be negative. Empty ranges return zero.
Example: ([4, -2, 7], [(0, 3), (1, 3), (2, 2)]) returns [9, 5, 0].
Raise ValueError for any range failing 0 <= left <= right <= len(values). Preserve both inputs, including on failure. Prototype: sum each range independently. Final: build one prefix table and target O(n+q) time, O(n) auxiliary space.
Drag or use the arrow keys to resize. Home collapses the question; End collapses the editor. Enter or double-click resets the split.
Loading editor…
Loading editor…
No results yet.
Complete the starter code, then run the checks.
Results and errors will appear here.