Function aoc::y22d06::y22d06

source ·
pub fn y22d06(input: &str, size: usize) -> Option<u32>
Expand description

The solution for the day six challenge.

Given the input as a string it splits it into characters and then evaluates each window of size characters while maintaining a counter of the current window. Once all of the elements are distinct then we return the counter plus the size offset.

§Example

let input = "abbccdefghij\n"; // probably read this from the input file...
assert_eq!(y22d06(&input, 4), Some(8));