diff --git a/2022/Cargo.toml b/2022/Cargo.toml index 82f2248..ea67c1c 100644 --- a/2022/Cargo.toml +++ b/2022/Cargo.toml @@ -9,4 +9,3 @@ edition = "2021" anyhow = "1.0" regex = "1" lazy_static = "1.4.0" -itertools = "0.10.5" diff --git a/2022/src/bin/day6.rs b/2022/src/bin/day6.rs index 19e288a..b460eec 100644 --- a/2022/src/bin/day6.rs +++ b/2022/src/bin/day6.rs @@ -1,7 +1,6 @@ #![feature(test)] use anyhow::Result; use aoc::Solver; -use itertools::Itertools; // -- Runners -- fn main() -> Result<()> { @@ -70,7 +69,15 @@ mod tests { // -- Helpers -- fn is_start_marker(window: &[char]) -> bool { - window.len() == window.iter().unique().count() + for i in 0..window.len() { + for j in i+1..window.len() { + if window[i] == window[j] { + return false; + } + } + } + + return true; } fn solution(input: &str, length: usize) -> usize {