```
class Solution {
public:
int maxPoints(vector<Point>& points)
{
int number=points.size();
if(number<=2)
{
return number;
}
vector<int> SameSlope(number,0);
for(int i=0;i<number;i++)
{
vector<double> slope;
vector<int> slopepoints;
slope.push_back(INT_MAX);
slopepoints.push_back(0);
int samepoint=0;
for(int j=0;j<number;j++)
{
if(points[j].x-points[i].x==0 && points[j].y-points[i].y!=0)
{
slopepoints[0]+=1;
continue;
}
else if(points[j].x-points[i].x==0 && points[j].y-points[i].y==0)
{
samepoint+=1;
continue;
}
else
{
double tempslope=(points[j].y-points[i].y)/(points[j].x-points[i].x);
if(std::find(slope.begin(), slope.end(), tempslope)==slope.end())
{
slope.push_back(tempslope);
slopepoints.push_back(1);
continue;
}
/*delete else should have no impact*/
else
{
for(int k=0;k<slopepoints.size();k++)
{
if(tempslope==slope[k])
{
slopepoints[k]+=1;
break;
}
}
}
}
}
SameSlope[i]=*max_element(slopepoints.begin(),slopepoints.end())+samepoint;
}
int res=*max_element(SameSlope.begin(),SameSlope.end());
return res;
}
};
```