FastPrepRange Maximum Subarray Sum Queries
Problems/Range Maximum Subarray Sum Queries

Range Maximum Subarray Sum Queries

InMobi logoInMobi● HardNEW GRADOA

Updated Oct 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report supplies the range maximum-subarray objective and numeric bounds. The 1-based inclusive query representation and long-valued result array complete the executable interface, matching the central task at about 98%.

You are given a non-empty integer array and several range queries. Each query is a pair [left, right] using 1-based inclusive indices.

For every query, return the maximum possible sum of a non-empty contiguous subarray contained completely inside that query range.

Function

rangeMaximumSubarraySums(values: int[], queries: int[][]) → long[]

Examples

Example 1

values = [1,-2,3,4,-1]queries = [[1,5],[2,4],[2,2]]return = [7,7,-2]

The best sums are 3 + 4 for the first two ranges and the sole value -2 for the single-position range.

Constraints

  • 1 <= values.length <= 50000
  • -15000 <= values[i] <= 15000
  • 1 <= queries.length <= 50000
  • Every query satisfies 1 <= left <= right <= values.length.

Source note: Interview prompt excerpt preserved as source evidence.

More InMobi Online Assessment questions

  • Validate a Bracket SequenceOA · Seen Oct 2026
  • Count Substrings Matching with One Adjacent SwapOA · Seen Oct 2026
  • Maximum Subarray with Start and End WindowsOA · Seen Oct 2026
  • Minimum Service Cold StartsOA · Seen Oct 2026
  • Connected Components with Divisor ThresholdOA · Seen Aug 2026
  • Maximize Impression ValueOA · Seen Aug 2026
  • Supply Path OptimizationOA · Seen Aug 2026
  • Delivery ServiceOA · Seen Jun 2026
  • Shared InterestOA · Seen Jun 2026
  • Temporal AnomaliesOA · Seen Jun 2026

Similar questions at other companies

  • Minimum Sorted Erasure OperationsAtlassian · OAAtlassian interview questions
  • Minimum Bridge TurnbacksBNSF Railway · OABNSF Railway interview questions
  • Maximum Profit from an Increasing Price TripletOdoo · OAOdoo interview questions
  • Longest Increasing Subsequence With Bounded Adjacent DifferenceGoogle · PHONE SCREENGoogle interview questions
  • Longest Increasing Subsequence With Bounded Adjacent DifferenceAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Volunteer Awards: Totals Divisible by KNutanix · ONSITE INTERVIEWNutanix interview questions
  • At Most K Jumps with Quadratic Transition CostInfosys · OAInfosys interview questions
  • Largest Consistent Visiting GroupAuxoAI · OA
  • Delete K Subsets for Maximum ScoreRubrik · OARubrik interview questions
  • Safest Shortest Path Through a GridSnowflake · OASnowflake interview questions
All InMobi interview questionsSee InMobi hiring insights
Saved
class Solution {
    public long[] rangeMaximumSubarraySums(int[] values, int[][] queries) {
        // Write your code here.
    }

}
Checking account…