Just working code


  • 0
    O
    # Definition for a point.
    # class Point:
    #     def __init__(self, a=0, b=0):
    #         self.x = a
    #         self.y = b
    
    class Solution:
        def maxPoints(self, points):
            """
            :type points: List[Point]
            :rtype: int
            """
            answrs = list()
            for num in range(0, len(points)-2):
                cap = 0
                for point in points:
                    cap += 0 if ((point.x - points[num].x)/(points[num+1].x - points[num].x)) - ((point.y - points[num].y)/(points[num+1].y - points[num].y)) else 1
                answrs.append(cap)
            return max(answrs)
    

    Test it yourself. It work for me.


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.