题目:
Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.
解决:
[java] view
plaincopy
import java.util.HashMap;
import java.util.Map;
class Point {
int x;
int y;
Point() {
x = 0;
y = 0;
}
Point(int a, int b) {
x = a;
y = b;
}
}
/**
* 暴力破解:
* 遍历所有的点,每次取一个点,计算这个点与其他点斜率k,对k统计,......
阅读全文