Remove slow day 9 solution
This commit is contained in:
parent
8d6bd53e85
commit
7acfca5132
1 changed files with 1 additions and 16 deletions
17
src/day09.rs
17
src/day09.rs
|
@ -37,22 +37,7 @@ pub fn solve_part1(input: &Vec<usize>) -> usize {
|
|||
panic!("No match found!");
|
||||
}
|
||||
|
||||
#[aoc(day9, part2, bruteforce)]
|
||||
#[inline(always)]
|
||||
pub fn solve_part2(input: &Vec<usize>) -> usize {
|
||||
let inv_num = solve_part1(input);
|
||||
for start in 0..input.len() {
|
||||
for length in 2..(input.len() - start) {
|
||||
let s: Vec<usize> = input.iter().skip(start).take(length).cloned().collect();
|
||||
if s.iter().sum::<usize>() == inv_num {
|
||||
return s.iter().max().unwrap() + s.iter().min().unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
panic!("No match found!");
|
||||
}
|
||||
|
||||
#[aoc(day9, part2, faster)]
|
||||
#[aoc(day9, part2)]
|
||||
#[inline(always)]
|
||||
pub fn solve_part2_fast(input: &Vec<usize>) -> usize {
|
||||
let target_num = solve_part1(input);
|
||||
|
|
Loading…
Reference in a new issue