对于给定的n个位于同一二维平面上的点,求最多能有多少个点位于同一直线上
示例1
输入
[(0,0),(0,1)]
输出
2
示例2
输入
[(2,3),(3,3),(-5,3)]
输出
3
加载中...
import java.util.*; /* * public class Point { * int x; * int y; * } */ public class Solution { /** * * @param points Point类一维数组 * @return int整型 */ public int maxPoints (Point[] points) { // write code here } }
/** * struct Point { * int x; * int y; * }; */ class Solution { public: /** * * @param points Point类vector * @return int整型 */ int maxPoints(vector
& points) { // write code here } };
# class Point: # def __init__(self, a=0, b=0): # self.x = a # self.y = b # # # @param points Point类一维数组 # @return int整型 # class Solution: def maxPoints(self , points ): # write code here
/* * function Point(a, b){ * this.x = a || 0; * this.y = b || 0; * } */ /** * * @param points Point类一维数组 * @return int整型 */ function maxPoints( points ) { // write code here } module.exports = { maxPoints : maxPoints };
# class Point: # def __init__(self, a=0, b=0): # self.x = a # self.y = b # # # @param points Point类一维数组 # @return int整型 # class Solution: def maxPoints(self , points ): # write code here
package main import . "nc_tools" /* * type Point struct { * X int * Y int * } */ /** * * @param points Point类一维数组 * @return int整型 */ func maxPoints( points []*Point ) int { // write code here }
[(0,0),(0,1)]
2
[(2,3),(3,3),(-5,3)]
3