Skip to content

Commit

Permalink
Update minimum-total-distance-traveled.py
Browse files Browse the repository at this point in the history
  • Loading branch information
kamyu104 authored Nov 6, 2022
1 parent bed4c9e commit 92f9a4e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Python/minimum-total-distance-traveled.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def minimumTotalDistance(self, robot, factory):
dp[0] = 0
for i in xrange(len(factory)):
prefix = 0
dq = collections.deque([(dp[0]-prefix, 0)])
dq = collections.deque([(dp[0]-prefix, 0)]) # pattern of min in the sliding window
for j in xrange(1, len(robot)+1):
prefix += abs(robot[j-1]-factory[i][0])
if j-dq[-1][1] == factory[i][1]+1:
Expand Down

0 comments on commit 92f9a4e

Please sign in to comment.