FastPrepRange Booking Totals
Problems/Range Booking Totals

Range Booking Totals

Google logoGoogle● MediumFULLTIMEONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A candidate described a fast-track Google interview for a senior forward-deployed engineer role with two rounds. The coding round was described only by its technique, prefix sums with a difference array. The candidate likened it to a classic range-update exercise in which bookings are added over ranges and a total is reported for each position. The report gives no statement, examples, or limits.

This version is the range-booking total that the report points to. Requests add units to every slot in an inclusive range of 1-based slots, and the answer lists the total per slot. The slot and request framing, the input shape, the examples, and all limits are our choice.

Our version is about 60% the same as the reported question.

A shared resource has n time slots, numbered 1 to n. Each entry bookings[i] = [start, end, units] reserves units units in every slot from start to end, inclusive.

Return an array totals of length n, where totals[j] is the total number of units reserved in slot j + 1 by all bookings.

Function

rangeBookingTotals(bookings: int[][], n: int) → int[]

Examples

Example 1

bookings = [[1,3,4],[2,5,2],[4,4,7]]n = 5return = [4,6,6,9,2]

Slot 1 is covered only by the first request (4). Slots 2 and 3 are covered by the first two (4 + 2 = 6). Slot 4 is covered by the second and third (2 + 7 = 9). Slot 5 is covered only by the second (2).

Example 2

bookings = [[2,2,5],[2,2,1]]n = 3return = [0,6,0]

Both requests cover only slot 2, so it gets 5 + 1 = 6. Slots 1 and 3 get nothing.

Example 3

bookings = [[1,4,3]]n = 4return = [3,3,3,3]

One request covers every slot, so each slot gets 3.

Constraints

  • 1 <= n <= 1000
  • 1 <= bookings.length <= 2000
  • bookings[i] = [start, end, units] with 1 <= start <= end <= n
  • 1 <= units <= 10^4

More Google Onsite Interview questions

  • Delete Nodes and Return Forest RootsONSITE INTERVIEW · Seen Nov 2026
  • Dice-Walk Winning ProbabilityPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • First and Last Target Position in a Mountain ArrayONSITE INTERVIEW · Seen Nov 2026
  • Lowest Common Ancestor in an N-ary TreePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • 0/1 Knapsack with Weight and Volume LimitsONSITE INTERVIEW · Seen Nov 2026
  • Batched Subsequence Word MatchesONSITE INTERVIEW · Seen Nov 2026
  • Course Schedule Cycle DetectionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Filesystem Entity Total SizeONSITE INTERVIEW · Seen Nov 2026
  • Longest Subarray Within an Absolute-Difference LimitONSITE INTERVIEW · Seen Nov 2026
  • Reach a Destination Through Scheduled FlightsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Count Subarrays with Equal Even and Odd CountsMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Product of Array Except SelfWalmart Labs · ONSITE INTERVIEW
  • Subarrays Whose Sum Is a Power of TwoKotak Mahindra Bank · ONSITE INTERVIEWKotak Mahindra Bank interview questions
  • Maximize Compatible Car RidersUber Freight · PHONE SCREEN · ONSITE INTERVIEWUber Freight interview questions
  • Count Subarrays with Sum KMakeMyTrip.com · ONSITE INTERVIEWMakeMyTrip.com interview questions
  • Product Of Array Except SelfInfosys · ONSITE INTERVIEWInfosys interview questions
  • Centered K-by-K Submatrix SumsCitadel · ONSITE INTERVIEWCitadel interview questions
  • Farthest Affordable Shop per QueryAdobe · ONSITE INTERVIEWAdobe interview questions
  • Product of Array Except SelfSquarepoint Capital · ONSITE INTERVIEWSquarepoint Capital interview questions
  • Weighted Lottery WinnersAmazon · ONSITE INTERVIEW

Google interview experiences

  • Google L4 SWE Phone Screen: 1 Experience
  • Google ML Engineering Manager Onsite: 1 Experience
  • Google Experienced SWE First Round and Onsite: 1 Experience
  • Google AI Coding Interview and AI OA: 2 Experiences
  • Google SWE Intern Interview Results Timeline: 13 Experiences
  • Google L4 SWE Phone Screen and Kirkland Onsite: 1 Experience
All Google interview questionsSee Google hiring insights
Saved
class Solution {
    public int[] rangeBookingTotals(int[][] bookings, int n) {
        // Write your code here.
    }
}
Checking account…