LeetCode 149, Hard . Topics: Array , Hash Table , Math , Geometry . View on LeetCode .
Generate this problem as a practice environment: tested reference solution, 15 parametrized pytest cases , and a playground notebook:
Problem
Given an array of points where points[i] = [xi, yi] represents a point on the X-Y plane, return the maximum number of points that lie on the same straight line.
Examples
Constraints
1 <= points.length <= 300
points[i].length == 2
-10^4 <= xi, yi <= 10^4
All the points are unique.
Solution
Reference implementation from solution.py on GitHub , full suite in test_solution.py :
Complexity
NeetCode All , AlgoMaster 75 .Last modified on September 7, 2026