Skip to content

Commit 4b11a99

Browse files
committed
Runtime: 168 ms (Top 19.82%) | Memory: 126.2 MB (Top 22.91%)
1 parent 7d0dd97 commit 4b11a99

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Runtime: 168 ms (Top 19.82%) | Memory: 126.2 MB (Top 22.91%)
12
class Solution {
23
public int earliestFullBloom(int[] plantTime, int[] growTime) {
34
int n = plantTime.length;
@@ -7,17 +8,17 @@ public int earliestFullBloom(int[] plantTime, int[] growTime) {
78
plants[i] = new int[]{plantTime[i], growTime[i]};
89
totalPlantTime += plantTime[i];
910
}
10-
// Sort plants by grow time.
11-
// The plant with fewer grow time can be planted at the end.
11+
// Sort plants by grow time.
12+
// The plant with fewer grow time can be planted at the end.
1213
Arrays.sort(plants, (a, b) -> a[1] - b[1]);
13-
// Max grow + plant time
14+
// Max grow + plant time
1415
int maxTime = 0;
1516
for (int[] plant : plants) {
1617
maxTime = Math.max(maxTime, totalPlantTime + plant[1]);
17-
// After putting this plant at the end of the chain,
18-
// we can take the current plant time out of the total plant time
18+
// After putting this plant at the end of the chain,
19+
// we can take the current plant time out of the total plant time
1920
totalPlantTime -= plant[0];
2021
}
2122
return maxTime;
2223
}
23-
}
24+
}

0 commit comments

Comments
 (0)