Back to problems

Max Points on a Line

Algorithm · Microsoft · Hard

You are given points in a two-dimensional coordinate system, with points[i] = [xi, yi]. Determine the largest count of points positioned on one common straight line. Requirements: Your approach must account for repeated coordinates, vertical lines (whose slope is unbounded), and normalized slope forms so that floating-point precision is not needed. Constraints: 1 <= n <= 300, -10^4 <= xi, yi <= 10^4. I/O format (stdin/stdout): Input: the first line contains n, followed by n…

Checking your access…