Loading repovive.com/problems/classics/29
Given an array of n integers, answer q queries. Each query gives two indices l and r, and asks for the sum of elements from index l to r (inclusive).
5 3 1 2 3 4 5 1 3 2 4 1 5
For this input, the required output is 6 9 15.
6 9 15
4 2 -1 2 -3 4 1 4 2 3
For this input, the required output is 2 -1.
2 -1
3 3 10 20 30 1 1 2 2 3 3
For this input, the required output is 10 20 30.
10 20 30