FastPrepRange Sum Queries
Problems/Range Sum Queries

Range Sum Queries

Intuit logoIntuit● EasyINTERNOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Intuit intern online assessment. The report gives range-sum queries but leaves out the indexing and limits on the numbers. This version uses ranges that start at zero and include both ends. Our version is about 90% the same as the reported question.

You are given an integer array nums and range queries. Each row of queries is [left,right].

For each query, return the sum of nums[left] through nums[right]. Indices start at zero, and both endpoints are included. Return one 64-bit sum per query, in the original query order.

An empty query list returns an empty array. If nums is empty, the query list is also empty.

Function

rangeSums(nums: int[], queries: int[][]) → long[]

Examples

Example 1

nums = [1,2,3,4,5]queries = [[0,2],[1,3],[2,2]]return = [6,9,3]

The sums are 1 + 2 + 3 = 6, 2 + 3 + 4 = 9, and 3.

Example 2

nums = [-2,5,-3]queries = [[0,2],[0,0],[1,2]]return = [0,-2,2]

The full array sums to zero. A one-element range can be negative.

Constraints

  • For this exercise, assume 0 <= nums.length <= 200000 and 0 <= queries.length <= 200000.
  • For this exercise, assume -10^9 <= nums[i] <= 10^9.
  • Every query satisfies 0 <= left <= right < nums.length.

More Intuit Online Assessment questions

  • Employee Promotion OpportunitiesOA · Seen Oct 2026
  • Next Pascal Row CoefficientOA · Seen Oct 2026
  • Parse Router LogsOA · Seen Oct 2026
  • Longest Repeated Letter Block with Adjacent SwapsOA · Seen Oct 2026
  • Maximum Square-Free DivisorOA · Seen Oct 2026
  • Two Tribes from Taller-Person CountsOA · Seen Oct 2026
  • Shortest Path from an Encoded GraphOA · Seen Sep 2026
  • Oldest and Youngest EmployeesOA · Seen Sep 2026
  • Pressure-Isolation Shutdown OrderOA · Seen Sep 2026
  • Submask Sum QueriesOA · Seen Sep 2026

Similar questions at other companies

  • Minimum Positive Starting ValueBooking.com · OA
  • Array Interval SumsHeadlands Technologies · OAHeadlands Technologies interview questions
  • Minimum AmountBelvedere Trading · OA
  • Online No-Intercept Linear RegressionTwo Sigma · OATwo Sigma interview questions
  • Shortest Distance on a Circular Bus RouteAmazon · OA
  • Count Sortable SplitsGoogle · OAGoogle interview questions
  • Array Challenge (QR Intern)Akuna Capital · OAAkuna Capital interview questions
  • Range Negation UpdatesJP Morgan Chase · OAJP Morgan Chase interview questions
  • Threshold AlertsGoldman Sachs · OAGoldman Sachs interview questions
  • First Prefix Reaching a Target ScoreVisa · OAVisa interview questions

Intuit interview experiences

  • Intuit Software Engineering Intern - Full Stack OA Format
All Intuit interview questionsSee Intuit hiring insights
Saved
class Solution {
    public long[] rangeSums(int[] nums, int[][] queries) {
        // Write your code here
    }
}
Checking account…