8000 * Done with "2136. Earliest Possible Day of Full Bloom". · garciparedes/leetcode@9d3a173 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9d3a173

Browse files
committed
* Done with "2136. Earliest Possible Day of Full Bloom".
1 parent b6fe380 commit 9d3a173

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Solution:
2+
def earliestFullBloom(self, plantTime: List[int], growTime: List[int]) -> int:
3+
n = len(plantTime)
4+
times = list()
5+
for i in range(n):
6+
times.append((plantTime[i], growTime[i]))
7+
8+
total = 0
9+
current = 0
10+
times.sort(key=lambda x: (-x[1], x[0]))
11+
for i in range(n):
12+
total = max(total, current + times[i][0] + times[i][1])
13+
current += times[i][0]
14+
15+
return total

0 commit comments

Comments
 (0)
0