Only 2 line c++ solution


#1

int Solution::maxp3(vector &A)
{
sort(A.begin(),A.end(),greater());
return max(A[0]*A[1]*A[2],A[0]*A[A.size()-1]*A[A.size()-2]);
}