From 88aa00426ab84062b74156649506c7f65233c9c8 Mon Sep 17 00:00:00 2001 From: DJ O'Leary Date: Thu, 4 Dec 2025 02:14:30 +0100 Subject: docs(2025d03p01): add implementation plan --- 2025/ocaml/lib/application/d03p01.ml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/2025/ocaml/lib/application/d03p01.ml b/2025/ocaml/lib/application/d03p01.ml index 26319df..b63679e 100644 --- a/2025/ocaml/lib/application/d03p01.ml +++ b/2025/ocaml/lib/application/d03p01.ml @@ -1 +1,20 @@ +(** Day 3 Part 1 + Implementation Plan: + + For each line: + 1. Start with the tuple [(None, None)] + 2. Put the first two digits in the sequence into the tuple => [(Some m, Some n)] + 3. Walk the sequence + - IF the digit in the sequence is greater than the first element of the tuple + AND we are not looking at the last digit in the sequence, + replace the first element of the tuple with that digit and set the other digit to None. + - IF the digit in the sequence did not replace the first element of the tuple + AND the digit is greater than the second element of the tuple, + replace the second element of the tuple with that digit. + 4. Concat the elements of the tuple "string-wise" => [(Some m', Some n')] => [m' ^ n'] + 5. Cast to int + + Sum the result of each line + *) + let solve _ () = failwith "not started" -- cgit v1.2.3