int Solution::solve(vector &A) {

int maxA = INT_MIN, maxB = INT_MIN, maxC = INT_MIN;

int n= A.size();

```
for (int i = 0; i < n; i++) {
if (A[i] > maxA) {
maxC = maxB;
maxB = maxA;
maxA = A[i];
}
else if (A[i] > maxB) {
maxC = maxB;
maxB = A[i];
}
else if (A[i] > maxC)
maxC = A[i];
}
return (maxA + maxB + maxC);
```

}