https://leetcode.com/problems/max-points-on-a-line/


Runtime: 1002 ms, faster than 5.04% of Python3 online submissions for Max Points on a Line.

Memory Usage: 15 MB, less than 28.47% of Python3 online submissions for Max Points on a Line.


```python
from itertools import combinations

class Solution:
    def maxPoints(self, points: List[List[int]]) -> int:
        #7:51
        if len(points) == 1:
            return 1

        def get_slop_rate(x1,y1,x2,y2):
            a = (y2 - y1)
            b = (x2 - x1)
            if b == 0:
                return None, [x1,y1]
            return (y2 - y1) / (x2 - x1), [x1,y1]
        
        all_possible_combinations_for_two_points = combinations(points, 2)
        all_possible_lines = [get_slop_rate(a[0], a[1], b[0], b[1]) for a, b in all_possible_combinations_for_two_points]
        #all_possible_lines = [one for one in all_possible_lines if one[0] != None]
        
        maximum_points_number_in_a_line = 0
        for one in all_possible_lines:
            slop_rate = one[0]
            one_point = one[1]
            counting = 0
            for another_point in points:
                if (get_slop_rate(one_point[0], one_point[1], another_point[0], another_point[1])[0] == slop_rate or one_point == another_point):
                    counting += 1
            if counting > maximum_points_number_in_a_line:
                maximum_points_number_in_a_line = counting
        
        return maximum_points_number_in_a_line
        #8:01
        #debug until 8:06
```
