All Downloads are FREE. Search and download functionalities are using the official Maven repository.

g0101_0200.s0149_max_points_on_a_line.readme.md Maven / Gradle / Ivy

There is a newer version: 1.24
Show newest version
149\. Max Points on a Line

Hard

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_.

**Example 1:**

![](https://assets.leetcode.com/uploads/2021/02/25/plane1.jpg)

**Input:** points = [[1,1],[2,2],[3,3]]

**Output:** 3 

**Example 2:**

![](https://assets.leetcode.com/uploads/2021/02/25/plane2.jpg)

**Input:** points = [[1,1],[3,2],[5,3],[4,1],[2,3],[1,4]]

**Output:** 4 

**Constraints:**

*   `1 <= points.length <= 300`
*   `points[i].length == 2`
*   -104 <= xi, yi <= 104
*   All the `points` are **unique**.




© 2015 - 2024 Weber Informatics LLC | Privacy Policy