Very easy 3 lines c++ solution


#1

int Solution::maxp3(vector &A) {

sort(A.rbegin(), A.rend());
int ans = max(A[0] * A[1] * A[2], A[0] * A[A.size() - 1] * A[A.size() - 2]);

return ans;

}


#2

Fails for {-1,1,2,50,70}

ur codes gives max{-112, -15070)…which is -2;
where as correct ans is 25070