FastPrepBatch Point-in-Range Queries
Problems/Batch Point-in-Range Queries

Batch Point-in-Range Queries

Google logoGoogle● MediumINTERNPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A firsthand report from a Google intern interview in Shanghai asks whether a number, possibly a float, falls in any of the given ranges. It stresses scale and complexity. The report does not say how queries come in a batch, whether range ends are included, how large the values can be, or how to compare them. We added those: queries come as a batch, both ends count, values are finite, and comparison is direct. Our version is about 87% the same as the reported question.

You are given closed numeric ranges in ranges and query values in points. Each range is [left, right] and includes both endpoints.

Return a boolean array where result i is true exactly when points[i] lies in at least one range.

Ranges may overlap or touch, and all inputs may contain fractional values. Compare the supplied finite values directly; do not apply an epsilon.

Function

pointsInRanges(ranges: double[][], points: double[]) → boolean[]

Examples

Example 1

ranges = [[1.5,3.0],[5.0,7.25]]points = [1.5,4.0,7.25]return = [true,false,true]

The first and third values equal closed endpoints, while 4.0 lies in the gap.

Example 2

ranges = [[0.0,2.0],[1.0,4.0],[-2.0,-1.0]]points = [-1.0,0.0,3.5,4.1]return = [true,true,true,false]

The overlapping first two ranges cover every value from 0.0 through 4.0. The negative range includes -1.0.

Example 3

ranges = []points = [0.0,-2.5]return = [false,false]

No point is covered when there are no ranges.

Constraints

  • 0 <= ranges.length, points.length <= 200000.
  • Every range contains exactly two finite values and satisfies ranges[i][0] <= ranges[i][1].
  • Every point is finite.
  • Every endpoint and point is between -10^12 and 10^12.

More Google Phone Screen questions

  • Route Pattern MatcherPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Periodic-Color Binary Forest RootsPHONE SCREEN · Seen Nov 2026
  • Evaluate a Nested Math ExpressionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Best Stock Trade with Buy and Sell DaysPHONE SCREEN · Seen Nov 2026
  • Word Chain Jumps in a GridPHONE SCREEN · Seen Nov 2026
  • Dice-Walk Winning ProbabilityPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Lowest Common Ancestor in an N-ary TreePHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Apartment Housemate PreferencesPHONE SCREEN · Seen Nov 2026
  • Price at Query TimestampsPHONE SCREEN · Seen Nov 2026
  • Course Schedule Cycle DetectionPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026

Similar questions at other companies

  • Classify Heap Addresses from a Memory SnapshotSquarepoint Capital · PHONE SCREENSquarepoint Capital interview questions
  • Maximum Profit in Job SchedulingAmazon · PHONE SCREEN
  • Maximum Interactive Team SizeMicrosoft · OAMicrosoft interview questions
  • Maximum Team SizeExpedia · OAExpedia interview questions
  • Employee With the Most OverlapsCitadel · OACitadel interview questions
  • Merge IntervalsApple · OA · PHONE SCREEN · ONSITE INTERVIEWApple interview questions
  • Merge Overlapping IntervalsAtlassian · PHONE SCREEN · ONSITE INTERVIEWAtlassian interview questions
  • Peak Chat Load Across AgentsCresta · PHONE SCREENCresta interview questions
  • Meeting Rooms IIeBay · PHONE SCREENeBay interview questions
  • Meeting Rooms IIByteDance · PHONE SCREENByteDance interview questions

Interview reports that mention this question

  • Google SWE Intern Onsite Questions: 16 Experiences (Part 2 of 3)

Google interview experiences

  • Google interviews · November 2026
  • Google Software Engineer Onsite Questions: 10 Experiences
  • Google OA: What It Tests (2026)
  • Google L4 SWE Phone Screen: 1 Experience
  • Google ML Engineering Manager Onsite: 1 Experience
All Google interview questionsSee Google hiring insights
Saved
class Solution {
    public boolean[] pointsInRanges(double[][] ranges, double[] points) {
        // Write your code here.
    }
}
Checking account…