216 - 149 直线上最多的点数
Last updated
Was this helpful?
Last updated
Was this helpful?
给定一个二维平面,平面上有 n 个点,求最多有多少个点在同一条直线上。
示例 1:
输入: [[1,1],[2,2],[3,3]] 输出: 3 解释: ^ | | o | o | o +-------------> 0 1 2 3 4
示例 2:
输入: [[1,1],[3,2],[5,3],[4,1],[2,3],[1,4]] 输出: 4 解释: ^ | | o | o o | o | o o +-------------------> 0 1 2 3 4 5 6
感觉可以,任意两点做直线,看有多少点在这根直线上
Runtime: 72 ms, faster than 67.14% of Python3 online submissions for Max Points on a Line.
Memory Usage: 12.9 MB, less than 100.00% of Python3 online submissions for Max Points on a Line.