1
class Solution {
2
public int minStoneSum(int[] A, int k) {
3
PriorityQueue<Integer> pq = new PriorityQueue<>((a, b) -> b - a);
4
int res = 0;
5
for (int a : A) {
6
pq.add(a);
7
res += a;
8
}
9
while (k-- > 0) {
10
int a = pq.poll();
11
pq.add(a - a / 2);
12
res -= a / 2;
13
}
14
return res;
15
}
16
}

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0