advent_of_code_2022

My (attempted) solutions to the 2022 Advent of Code
git clone https://git.eamoncaddigan.net/advent_of_code_2022.git
Log | Files | Refs | README

commit 8003346de8b4da4cf289608d54f5d2c2e6fa9637
parent 5e7795bf910a8778d153bad8fa4e6f00fc72e1c9
Author: Eamon Caddigan <eamon.caddigan@gmail.com>
Date:   Mon,  5 Dec 2022 21:43:56 -0800

Solution to day 6, part 1.

Diffstat:
Asrc/day_6.jl | 23+++++++++++++++++++++++
1 file changed, 23 insertions(+), 0 deletions(-)

diff --git a/src/day_6.jl b/src/day_6.jl @@ -0,0 +1,23 @@ +#!/usr/bin/env julia +# https://adventofcode.com/2022/day/6 +using AdventOfCode + +example = ["mjqjpqmgbljsphdztnvjfqwrcgsmlb"] +input = readlines("data/day_6.txt") + +function part_1(input) + transmission = first(input) + for i = 4:lastindex(transmission) + if allunique(transmission[i-3:i]) + return i + end + end +end +@assert part_1(example) == 7 +@info part_1(input) + +function part_2(input) + nothing +end +@assert part_2(example) == nothing +@info part_2(input)