Given an integer array nums
, handle multiple queries of the following type:
nums
between indices left
and right
inclusive where left <= right
.Examples for array [-2, 0, 3, -5, 2, -1]
:
Query(0, 2) => 1
Query(2, 5) => -1
Query(0, 5) => -3
Problem at Leetcode