My simple approach to this problem


#1

int Solution::solve(vector &A) {
sort(A.begin(),A.end());
int sum=A.front()+A.back();
return sum;
}