Skip to content

Commit 4691938

Browse files
authored
Update minimum-time-to-finish-the-race.py
1 parent cc1fe5b commit 4691938

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

Python/minimum-time-to-finish-the-race.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,5 @@ def ceil_log2(x):
2424
cnt += 1
2525
dp2 = [float("inf")]*numLaps # dp2[i]: min time to complete i+1 laps with changing zero or more tires
2626
for i in xrange(numLaps):
27-
for j in xrange(min(i+1, len(dp))):
28-
dp2[i] = min(dp2[i], (dp2[i-j-1]+changeTime if i-j-1 >= 0 else 0)+dp[j])
27+
dp2[i] = min((dp2[i-j-1]+changeTime if i-j-1 >= 0 else 0)+dp[j] for j in xrange(min(i+1, len(dp))))
2928
return dp2[-1]

0 commit comments

Comments
 (0)