diff options
| author | DJ O'Leary <dijitol@proton.me> | 2025-12-04 02:14:30 +0100 |
|---|---|---|
| committer | DJ O'Leary <dijitol@proton.me> | 2025-12-04 02:14:30 +0100 |
| commit | 88aa00426ab84062b74156649506c7f65233c9c8 (patch) | |
| tree | 0fef852265baf92a9a969b1dad4e794fdc646fd0 /2025/ocaml | |
| parent | 8ff2c5016d4359c4d5d583c7fc78a66f296bdebc (diff) | |
docs(2025d03p01): add implementation plan
Diffstat (limited to '2025/ocaml')
| -rw-r--r-- | 2025/ocaml/lib/application/d03p01.ml | 19 |
1 files changed, 19 insertions, 0 deletions
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" |
