FastPrepAre All Points Collinear?
Problems/Are All Points Collinear?

Are All Points Collinear?

Google logoGoogle● EasyFULLTIMENEW GRADPHONE SCREENONSITE INTERVIEW

Updated Oct 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The Google Brain AI phone report asks for an algorithm to test collinearity of a two-dimensional matrix of points. Integer coordinates, duplicate and small-input behavior, and numeric bounds are explicit practice assumptions. Approximate source match: 90%.

You are given a matrix points, where each row [x, y] is one point in the plane. Return true if all points lie on one straight line, and false otherwise.

Repeated coordinates are allowed. Zero, one, or two points are considered collinear. A vertical line is a valid straight line. Use exact integer geometry rather than floating-point slopes.

Function

arePointsCollinear(points: int[][]) → boolean

Examples

Example 1

points = [[1,2],[2,4],[3,6]]return = true

All points lie on y = 2x.

Example 2

points = [[0,0],[1,1],[1,2]]return = false

The last point does not lie on the line through the first two.

Example 3

points = [[4,-1],[4,-1],[4,3]]return = true

The duplicated point and the distinct point lie on the vertical line x = 4.

Constraints

  • 0 <= points.length <= 10000.
  • Every row contains exactly two integer coordinates.
  • -1000000 <= x, y <= 1000000.

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

  • Merchant Payout Reserve CalculatorStripe · PHONE SCREENStripe interview questions
  • Confusing Bib NumbersVerily · ONSITE INTERVIEW
  • Automation Pipeline, Part 1: Single WorkerPlaid · PHONE SCREENPlaid interview questions
  • Plus OneDruva · ONSITE INTERVIEW
  • Employee Count Median, Mean and ModeClay · PHONE SCREEN
  • Matrix MultiplicationeBay · ONSITE INTERVIEWeBay interview questions
  • Length of a Document Reached Through a Random TokenMercor · PHONE SCREENMercor interview questions
  • Maximum Product of Three IntegersPelatro · ONSITE INTERVIEW
  • Apply Affine Array TransformationsByteDance · PHONE SCREENByteDance interview questions
  • Exponential Backoff DelaysWonderful · PHONE SCREEN

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 arePointsCollinear(int[][] points) {
        // Write your code here
    }
}
Checking account…