Wrote custom check which is way faster
This commit is contained in:
parent
8e3012b56c
commit
714c699f9b
|
@ -9,4 +9,3 @@ edition = "2021"
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
regex = "1"
|
regex = "1"
|
||||||
lazy_static = "1.4.0"
|
lazy_static = "1.4.0"
|
||||||
itertools = "0.10.5"
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
#![feature(test)]
|
#![feature(test)]
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use aoc::Solver;
|
use aoc::Solver;
|
||||||
use itertools::Itertools;
|
|
||||||
|
|
||||||
// -- Runners --
|
// -- Runners --
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
|
@ -70,7 +69,15 @@ mod tests {
|
||||||
|
|
||||||
// -- Helpers --
|
// -- Helpers --
|
||||||
fn is_start_marker(window: &[char]) -> bool {
|
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 {
|
fn solution(input: &str, length: usize) -> usize {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user