I am proud of myself🤣


#1

int Solution::solve(vector &A, int B) {
int sum=0,i=A.size()-1;
while(B–)
{
sort(A.begin(),A.end());
sum+=A[i];
A[i]=A[i]-1;
}
return sum;
}