diff --git a/README.md b/README.md index 141870d..0c5e337 100644 --- a/README.md +++ b/README.md @@ -45,9 +45,9 @@ Solutions for [Advent of Code](https://adventofcode.com/) in [Rust](https://www. | [Day 12](./src/bin/12.rs) | `137.9µs` | `618.3µs` | | [Day 13](./src/bin/13.rs) | `12.3µs` | `15.9µs` | | [Day 14](./src/bin/14.rs) | `26.4µs` | `4.3ms` | -| [Day 15](./src/bin/15.rs) | `30.6µs` | `152.2µs` | +| [Day 15](./src/bin/15.rs) | `29.0µs` | `143.0µs` | -**Total: 6.89ms** +**Total: 6.88ms** --- diff --git a/src/bin/15.rs b/src/bin/15.rs index 41bc4e2..55351fb 100644 --- a/src/bin/15.rs +++ b/src/bin/15.rs @@ -3,12 +3,12 @@ advent_of_code::solution!(15); pub fn part_one(input: &str) -> Option { Some( input + .trim() .as_bytes() .split(|&ch| ch == b',') .map(|s| { s.iter() .copied() - .filter(|&ch| ch != b'\n') .fold(0, |acc, ch| ((acc + ch as u32) * 17) % 256) }) .sum(), @@ -18,6 +18,7 @@ pub fn part_one(input: &str) -> Option { pub fn part_two(input: &str) -> Option { let mut map = LensMap::new(); for op in input + .trim() .as_bytes() .split(|&ch| ch == b',') .map(Operation::from)