Company: Intuit_31july
Difficulty: easy
You are given an array of budget values and multiple range queries. For each query [L, R] , determine the sum of elements between indices L and R (inclusive, 0-indexed). Since the number of queries can be very large, an efficient solution is required: precompute prefix sums once and answer every query in O(1). Input Format The first line contains an integer N , representing the number of budget entries. The second line contains N space-separated integers representing the budget values. The third line contains an integer Q , representing the number of queries. The fourth line contains an integer representing the number of columns in the query matrix. This value is always 2 (each query has an L and an R ); it is part of the input and must be read and discarded. The next Q lines each contain two integers L and R . Output Format A single line containing Q space-separated integers: the answer to each query, in the order the queries were given. Constraints 1 <= N <= 200000 1 <= Q &l