Skip to content

Commit

Permalink
Day 21 part 2 solved
Browse files Browse the repository at this point in the history
  • Loading branch information
CcydtN committed Dec 22, 2024
1 parent 27fa2fc commit 47d04fa
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions src/bin/21.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,25 @@ pub fn part_one(input: &str) -> Option<u64> {
}

pub fn part_two(input: &str) -> Option<u64> {
None
let codes = input.split_whitespace().collect_vec();
let numeric_part = codes
.iter()
.map(|&code| code[..3].parse::<usize>().unwrap())
.collect_vec();
let mapping = generate_seq_map(25);

let sequence = codes
.iter()
.map(|code| code.chars().collect_vec())
.map(|code| helper(&code, &mapping))
.collect_vec();

sequence
.into_iter()
.zip(numeric_part)
.map(|(a, b)| dbg!(a) * dbg!(b))
.sum::<usize>()
.to_u64()
}

#[cfg(test)]
Expand All @@ -177,6 +195,6 @@ mod tests {
#[test]
fn test_part_two() {
let result = part_two(&advent_of_code::template::read_file("examples", DAY));
assert_eq!(result, None);
assert!(result.is_some());
}
}

0 comments on commit 47d04fa

Please sign in to comment.