Skip to content

Commit 39fbc03

Browse files
committed
Remove unused imports and update type hints for Ruff compatibility
1 parent f3379c3 commit 39fbc03

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

dynamic_programming/travelling_salesman.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import List, Tuple
1+
import sys
22

33

44
def tsp_dp(distances: list[list[float]]) -> tuple[float, list[int]]:
@@ -35,7 +35,7 @@ def solve(mask: int, pos: int) -> float:
3535
if state in dp:
3636
return dp[state]
3737

38-
minimum = float("inf")
38+
minimum = float('inf')
3939
min_next = -1
4040

4141
for next_city in range(n):
@@ -60,7 +60,7 @@ def solve(mask: int, pos: int) -> float:
6060
for _ in range(n - 1):
6161
next_pos = parent[(mask, pos)]
6262
path.append(next_pos)
63-
mask |= 1 << next_pos
63+
mask |= (1 << next_pos)
6464
pos = next_pos
6565

6666
return optimal_cost, path

0 commit comments

Comments
 (0)