File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ def tsp_brute_force(graph: list[list[int]]) -> int:
3333 total_cost = sum (graph [path [i ]][path [i + 1 ]] for i in range (n ))
3434 min_path = min (min_path , total_cost )
3535
36- return min_path
36+ return int ( min_path )
3737
3838
3939def tsp_dp (graph : list [list [int ]]) -> int :
@@ -78,7 +78,7 @@ def tsp_dp(graph: list[list[int]]) -> int:
7878
7979 # After completing visits to all cities,
8080 # return to city 0 and obtain the minimum value.
81- return min (dp [(1 << n ) - 1 ][i ] + graph [i ][0 ] for i in range (1 , n ))
81+ return int ( min (dp [(1 << n ) - 1 ][i ] + graph [i ][0 ] for i in range (1 , n ) ))
8282
8383
8484def tsp_greedy (graph : list [list [int ]]) -> int :
@@ -132,7 +132,7 @@ def tsp_greedy(graph: list[list[int]]) -> int:
132132 total_cost += graph [current ][0 ]
133133 path .append (0 )
134134
135- return total_cost
135+ return int ( total_cost )
136136
137137
138138def test_tsp_example () -> None :
You can’t perform that action at this time.
0 commit comments