C++ soln using Heap


#1

int Solution::solve(vector &A) {
int n=A.size();
priority_queue maxH;
priority_queue<int,vector,greater> minH;
for(int i=0;i<n;i++){
maxH.push(A[i]);
minH.push(A[i]);
}
return maxH.top()+minH.top();
}