public int maxPoints(Point[] points) {
        if(points.length <= 2) return points.length;

        Map<Double, Integer> map = new HashMap<Double, Integer>();
        int vertical = 1;
        int horizontal = 1;
        int dup = 0;

        for(int i = 0; i < points.length; i++){
            Point base = points[i];
            for(int j = 0; j < points.length; j++){
                if(i == j) continue;
                Point point = points[j];
                if(base.x == point.x && base.y == point.y){
                    dup++;
                }else if(base.x == point.x){
                    vertical++;
                }else if(base.y == point.y){
                    horizontal++;
                }else{
                    double slope = 10000 * (base.y - point.y)/(base.x - point.x);
                    if(!map.containsKey(slope)){
                        map.put(slope, 1);
                    }
                    map.put(slope, map.get(slope) + 1);
                }
            }
            max = findMax(map, vertical, horizontal, dup);
            vertical = 1;
            horizontal = 1;
            dup = 0;
            map.clear();
        }
        return max;
    }