Skip to content

Commit 870e252

Browse files
committed
add fix by claude
1 parent fa139b3 commit 870e252

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

src/main.rs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -227,34 +227,6 @@ fn permute_and_check(
227227
}
228228
}
229229

230-
fn permute_and_check(
231-
cities: &[City],
232-
prefix: &mut Vec<usize>,
233-
remaining: &mut Vec<usize>,
234-
start_idx: usize,
235-
best_distance: &mut f64,
236-
best_path: &mut Vec<usize>,
237-
) {
238-
if start_idx == remaining.len() {
239-
// Complete path
240-
let mut full_path = prefix.clone();
241-
full_path.extend_from_slice(remaining);
242-
243-
let distance = calculate_distance(cities, &full_path);
244-
if distance < *best_distance {
245-
*best_distance = distance;
246-
*best_path = full_path;
247-
}
248-
return;
249-
}
250-
251-
for i in start_idx..remaining.len() {
252-
remaining.swap(start_idx, i);
253-
permute_and_check(cities, prefix, remaining, start_idx + 1, best_distance, best_path);
254-
remaining.swap(start_idx, i);
255-
}
256-
}
257-
258230
fn calculate_distance(cities: &[City], path: &[usize]) -> f64 {
259231
let mut total = 0.0;
260232
for i in 0..path.len() {

0 commit comments

Comments
 (0)