Press "Enter" to skip to content

Posts tagged as “point”

花花酱 LeetCode 149. Max Points on a Line

Problem:

Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.



Idea:

count by slope

Time complexity: O(n^2)

Space complexity: O(n)

Solution:

C++ / pair

C++ / long