From 84ec86b63ac38423ce021448e379b87094f7d4ac Mon Sep 17 00:00:00 2001 From: Oscar Najera Date: Sat, 28 Jan 2023 03:46:12 +0100 Subject: more julia and formatted --- AoC2022/06/solver.jl | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 AoC2022/06/solver.jl (limited to 'AoC2022/06/solver.jl') diff --git a/AoC2022/06/solver.jl b/AoC2022/06/solver.jl new file mode 100644 index 0000000..0e3ed39 --- /dev/null +++ b/AoC2022/06/solver.jl @@ -0,0 +1,12 @@ +using Test + +input = open(read, "input") + +unique_slice(arr, i, l) = arr[i-l+1:i] |> unique |> length == l + +@testset "solution" begin + @test [ + findfirst(unique_slice(input, i, k) for i = k:length(input)-k+1) + k - 1 for + k ∈ (4, 14) + ] == [1655, 2665] +end -- cgit v1.2.3