1
0

Day 6 part 2 done

This commit is contained in:
Florent DENEF 2022-12-29 13:55:59 +01:00
parent 6a8ea1b392
commit 58e7eb909e
2 changed files with 9 additions and 0 deletions

View File

@ -48,4 +48,9 @@ fn main() {
let solution = prob6::solve_part1(include_str!("../prob6_part1.txt")); let solution = prob6::solve_part1(include_str!("../prob6_part1.txt"));
println!("Solution for problem 6 part 1: {solution}"); println!("Solution for problem 6 part 1: {solution}");
} }
{
let _file_path = "prob6_part1.txt";
let solution = prob6::solve_part2(include_str!("../prob6_part1.txt"));
println!("Solution for problem 6 part 2: {solution}");
}
} }

View File

@ -11,3 +11,7 @@ fn begin_datagram(datagram: &str, size: usize) -> usize {
pub fn solve_part1(content: &str) -> i32 { pub fn solve_part1(content: &str) -> i32 {
begin_datagram(content, 4) as i32 begin_datagram(content, 4) as i32
} }
pub fn solve_part2(content: &str) -> i32 {
begin_datagram(content, 14) as i32
}