From af2a2fc8fc8b2ff376b6f5a1cc557cfa0e4760f5 Mon Sep 17 00:00:00 2001 From: Shautvast Date: Tue, 12 Nov 2024 12:23:22 +0100 Subject: [PATCH] use pop --- solution2/src/algorithm.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/solution2/src/algorithm.rs b/solution2/src/algorithm.rs index 93407d1..036423a 100644 --- a/solution2/src/algorithm.rs +++ b/solution2/src/algorithm.rs @@ -86,7 +86,7 @@ pub fn find_optimal_path( // evict paths that are of max len while current_path.length() >= t { - _ = paths_to_consider.remove(paths_to_consider.len() - 1); + _ = paths_to_consider.pop(); if current_path.value() > max.value() { max = current_path.clone(); // sorry } @@ -183,7 +183,7 @@ pub fn find_optimal_path( } if !points_added { // dead end, evict - let ended = paths_to_consider.remove(paths_to_consider.len() - 1); + let ended = paths_to_consider.pop().unwrap(); if ended.value > max.value { max = ended; } @@ -223,7 +223,7 @@ mod tests { all_points.insert(point.clone()); } if loop_in_path { - println!("check"); + //println!("check"); //verify that this occurs let max_sum: f32 = opt .points .iter()