Skip to content

Commit eea4786

Browse files
committed
Runtime: 170 ms (Top 20.15%) | Memory: 15 MB (Top 44.78%)
1 parent 093510f commit eea4786

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/algorithms/S/Super Washing Machines/Super Washing Machines.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Runtime: 170 ms (Top 20.15%) | Memory: 15 MB (Top 44.78%)
12
from itertools import accumulate
23
class Solution:
34
def findMinMoves(self, machines: List[int]) -> int:
@@ -9,8 +10,7 @@ def findMinMoves(self, machines: List[int]) -> int:
910
left = list(accumulate(machines))
1011
result = 0
1112
for i in range(n):
12-
move_to_right = max(left[i] - (i+1)*avg, 0)
13+
move_to_right = max(left[i] - (i+1)*avg, 0)
1314
move_to_left = max(left[-1]-(left[i-1] if i!=0 else 0) - (n-i)*avg, 0)
1415
result = max(result, move_to_right + move_to_left)
1516
return result
16-

0 commit comments

Comments
 (0)