Skip to content

Commit 864b4d3

Browse files
committed
Runtime: 204 ms (Top 31.03%) | Memory: 131.5 MB (Top 7.83%)
1 parent 6c5a0b9 commit 864b4d3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

scripts/algorithms/N/Number of Flowers in Full Bloom/Number of Flowers in Full Bloom.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1+
// Runtime: 204 ms (Top 31.03%) | Memory: 131.5 MB (Top 7.83%)
12
class Solution {
23
public int[] fullBloomFlowers(int[][] flowers, int[] persons) {
34
int n = persons.length;
45
int[] result = new int[n];
56

67
TreeMap<Integer, Integer> treeMap = new TreeMap<>();
7-
// See explanation here: https://leetcode.com/problems/my-calendar-iii/discuss/109556/JavaC%2B%2B-Clean-Code
8+
// See explanation here: https://leetcode.com/problems/my-calendar-iii/discuss/109556/JavaC%2B%2B-Clean-Code
89
for (int[] flower : flowers) {
910
treeMap.put(flower[0], treeMap.getOrDefault(flower[0], 0) + 1);
10-
// use end + 1 instead of end
11+
// use end + 1 instead of end
1112
treeMap.put(flower[1] + 1, treeMap.getOrDefault(flower[1] + 1, 0) - 1);
1213
}
1314

@@ -20,9 +21,9 @@ public int[] fullBloomFlowers(int[][] flowers, int[] persons) {
2021

2122
for (int i = 0; i < n; i++) {
2223
Map.Entry<Integer, Integer> entry = sum.floorEntry(persons[i]);
23-
// if entry is null then result[i] = 0
24+
// if entry is null then result[i] = 0
2425
if (entry != null) result[i] = entry.getValue();
2526
}
2627
return result;
2728
}
28-
}
29+
}

0 commit comments

Comments
 (0)