We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ec63b96 commit e02790cCopy full SHA for e02790c
src/main/java/g3401_3500/s3457_eat_pizzas/Solution.java
@@ -16,15 +16,14 @@ public long maxWeight(int[] pizzas) {
16
int n = m / 4;
17
int index = 0;
18
for (int x = max; x > 0; --x) {
19
- if (count[x] == 0) {
20
- continue;
21
- }
22
- int c = count[x];
23
- while (c-- > 0) {
24
- pizzas[index++] = x;
25
26
- if (index >= m / 2) {
27
- break;
+ if (count[x] != 0) {
+ int c = count[x];
+ while (c-- > 0) {
+ pizzas[index++] = x;
+ }
+ if (index >= m / 2) {
+ break;
28
}
29
30
long ans = 0;
0 commit comments