Eazyyyyy Peezyyy solution using max heap


#1

#define M 1000000007
int Solution::nchoc(int A, vector &B) {
priority_queue< int> p;
long long i,sum=0;
for(i=0;i<B.size();i++) p.push(B[i]);
while(A–>0){
long long top=p.top();
sum=sum+top;
p.push(floor(top/2));
p.pop();
}
sum = sum % M;
return sum;
}