Easy few lines C++ code


#1

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