FunctionRacerProblemsRace

Most Points on One Line

HardHash mapsPython, JavaScript, TypeScript, Java, C++

Each item of points is [x, y], and no two points are the same. Return the largest number of points that lie on one straight line.

Example 1

points [[1,1],[2,2],[3,3],[0,4]]
returns 3

(1, 1), (2, 2) and (3, 3) are on one line.

Example 2

points [[0,0]]
returns 1

A single point.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Hash maps problems