FastPrepPoint Reachability Below a Strict Distance Threshold
Problems/Point Reachability Below a Strict Distance Threshold

Point Reachability Below a Strict Distance Threshold

Google logoGoogle● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The report asks whether you can reach the endpoint with each distance strictly below r, and discusses caching distances. It does not say which distance to use, whether the endpoints count, the edge cases, or the size limits. We assume points on a plane with Euclidean distance. Our version is about 80% the same as the reported question.

You are given unordered points in the plane, an integer radius r, and the indices start and end.

Two different point indices i and j are directly connected exactly when their distance is strictly less than r. Connections work in both directions, and a route may use intermediate points.

For this exercise, assume points are immutable two-dimensional integer coordinates, distance is Euclidean, and both endpoints are indices into this collection. Equal coordinates at different indices remain different vertices.

Equivalently, the direct connection test is (points[i][0] - points[j][0])^2 + (points[i][1] - points[j][1])^2 < r^2. A distance equal to r is excluded.

Return true if a route from start to end exists, and false otherwise. For this exercise, assume a point reaches itself through a path of length zero, even when r == 0.

For this exercise, assume one reachability query over one immutable point set. Return only this Boolean; distance caching is a discussion follow-up, with no additional returned values or required spatial partitioning.

Approach

A distance function is supplied, the rule is strict (distance < r), and the graph can be built and searched with BFS or DFS. A large-data follow-up discusses caching or precomputing distances to avoid repeated calculations.

Function

canReachPoint(points: int[][], r: int, start: int, end: int) → boolean

Examples

Example 1

points = [[0,0],[2,0],[4,0],[20,0]]r = 3start = 0end = 2return = true

The route 0 -> 1 -> 2 uses two distances of 2, both below 3. The endpoints do not need a direct connection.

Example 2

points = [[0,0],[3,4]]r = 5start = 0end = 1return = false

The only possible connection has distance exactly 5, so the strict threshold excludes it.

Example 3

points = [[7,-2]]r = 0start = 0end = 0return = true

The endpoint is already the starting point. The length-zero path exists even with radius 0.

Constraints

  • For this exercise, assume 1 <= points.length <= 2000.
  • Every point contains exactly two integers; for this exercise, assume -10^9 <= x, y <= 10^9.
  • For this exercise, assume an integer radius 0 <= r <= 10^9 and valid indices 0 <= start, end < points.length.
  • Points may be in any order and may contain duplicate coordinates. The point collection does not change.

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

  • Course ScheduleAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Linked Merchants Within Two HopsStripe · PHONE SCREENStripe interview questions
  • Shortest Pin Path Through TopicsPinterest · PHONE SCREENPinterest interview questions
  • Shortest Travel Time in a Grid with Traffic LightsWaymo · PHONE SCREENWaymo interview questions
  • Evaluate DivisionApple · PHONE SCREENApple interview questions
  • Shortest Word Chain Between Two WordsFanatics · PHONE SCREEN
  • Minimize CommuteDatabricks · OA · PHONE SCREENDatabricks interview questions
  • Crawl Same-Hostname URLs ConcurrentlyAnthropic · PHONE SCREENAnthropic interview questions
  • Possible BipartitionByteDance · PHONE SCREENByteDance interview questions
  • Route Graph Reachability with a Broken LinkFigma · PHONE SCREENFigma interview questions

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
  • Google Experienced SWE First Round and Onsite: 1 Experience
All Google interview questionsSee Google hiring insights
Saved
class Solution {
    public boolean canReachPoint(int[][] points, int r, int start, int end) {
        // Write your code here.
    }
}
Checking account…