From be85617367801c294fc6ea7e7bc72130352fc691 Mon Sep 17 00:00:00 2001 From: Shanti Chellaram Date: Tue, 6 Dec 2022 23:13:45 +0900 Subject: [PATCH] Day 6-1 --- day6.erl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 day6.erl diff --git a/day6.erl b/day6.erl new file mode 100644 index 0000000..4e61fc6 --- /dev/null +++ b/day6.erl @@ -0,0 +1,15 @@ +-module(day6). + +-export([solve/1]). + +solve(InputData) -> + {solve(InputData, 1), none}. + +solve(<>, N) -> solve(<>, N+1); +solve(<>, N) -> solve(<>, N+1); +solve(<>, N) -> solve(<>, N+1); +solve(<>, N) -> solve(<>, N+2); +solve(<>, N) -> solve(<>, N+3); +solve(<>, N) when A /= B andalso B /= C andalso C /= D andalso + A /= C andalso B /= D andalso A /= D -> N+3; +solve(<<_, Rest/binary>>, N) -> solve(Rest, N+1).