Skip to content

Commit 7658a64

Browse files
committed
Runtime: 93 ms (Top 33.43%) | Memory: 14.1 MB (Top 44.38%)
1 parent 3b30770 commit 7658a64

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1+
# Runtime: 93 ms (Top 33.43%) | Memory: 14.1 MB (Top 44.38%)
12
class Solution:
2-
def wateringPlants(self, plants: List[int], capacity: int) -> int:
3-
result = 0
4-
curCap = capacity
3+
def wateringPlants(self, plants: List[int], capacity: int) -> int:
4+
result = 0
5+
curCap = capacity
56

6-
for i in range(len(plants)):
7-
if curCap >= plants[i]:
8-
curCap -= plants[i]
9-
result += 1
7+
for i in range(len(plants)):
8+
if curCap >= plants[i]:
9+
curCap -= plants[i]
10+
result += 1
1011

11-
else:
12-
result += i * 2 + 1
13-
curCap = capacity - plants[i]
12+
else:
13+
result += i * 2 + 1
14+
curCap = capacity - plants[i]
1415

15-
return result
16+
return result

0 commit comments

Comments
 (0)