drop the itertools again

This commit is contained in:
2022-12-07 11:01:46 +01:00
parent 5e4e024fcb
commit 67fc0bbcb5

View File

@@ -1,4 +1,4 @@
use itertools::Itertools;
use std::collections::BTreeSet;
pub fn process_part_1(input: &str) -> usize {
find_unique_window_start(input, 4)
@@ -14,7 +14,7 @@ pub fn find_unique_window_start(input: &str, window_size: usize) -> usize {
.chars()
.collect::<Vec<_>>()
.windows(window_size)
.take_while(|x| x.iter().unique().count() != x.len())
.take_while(|x| x.iter().collect::<BTreeSet<_>>().len() != x.len())
.count()
}