Skip to content

Commit c3b1192

Browse files
authored
Update minimum-total-distance-traveled.cpp
1 parent 87ba70c commit c3b1192

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

C++/minimum-total-distance-traveled.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Solution {
1212
dp[0] = 0;
1313
for (int i = 0; i < size(factory); ++i) {
1414
int64_t prefix = 0;
15-
deque<pair<int64_t, int>> dq = {{dp[0] - prefix, 0}}; // pattern of min in the sliding window
15+
deque<pair<int64_t, int>> dq = {{dp[0] - prefix, 0}}; // pattern of min in the sliding window with size (limit+1)
1616
for (int j = 1; j <= size(robot); ++j) {
1717
prefix += abs(robot[j - 1] - factory[i][0]);
1818
if (j - dq.front().second == factory[i][1] + 1) {

0 commit comments

Comments
 (0)