Commit Graph

74 Commits

Author SHA1 Message Date
mgrettondann 54f14c0492 Simplify the code for 2024 day 7
Simplify may be in the eye of the beholder here.

This reduces code duplication, as both parts are effectively the same.
Part 2 just has an extra operation that can be carried out.
2024-12-07 18:13:06 +00:00
mgrettondann 799a25464b Do not use a set to record blocks in 2406.ml
Instead of using a set of locations to store the blocks in day2406.ml
return to using a string.

Sets have an O(lg n) lookup time in number of blocks.

Instead we use a single string which contains the whole map, which means
we can do O(1) lookup on a block.  This significantly improves
performance.
2024-12-07 10:12:50 +00:00
mgrettondann 8a454e2082 Add 2024 day 7. 2024-12-07 07:29:03 +00:00
mgrettondann 831bbf4f63 Move IntPair and PosSet into Aoc library.
These are obviously generic enough and useful for the future that they
can be moved to a shared library.
2024-12-06 17:15:37 +00:00
mgrettondann 38d0781c7e Reimplement 2024 day 6 to use a set.
This seems "better" from a functional perspective.  However, it runs
substantially slower for part 2.
2024-12-06 16:26:32 +00:00
mgrettondann 590637e0de Upgrade Ocamlformat version. 2024-12-06 15:42:18 +00:00
mgrettondann 7fbad713c3 2024 day 6 part 2 2024-12-06 15:41:18 +00:00
mgrettondann 1436db73fb 2024 day 6 part 1 2024-12-06 09:20:41 +00:00
mgrettondann c6fb838463 Make ints_of_string generic and move to lib. 2024-12-05 15:43:18 +00:00
mgrettondann 7508e7a9ea Use Hashtbl generic interface. 2024-12-05 11:30:44 +00:00
mgrettondann 137ef06d9d move 2405 to use a hash table. 2024-12-05 11:26:38 +00:00
mgrettondann 98a30229e4 2024 day 5 both parts. 2024-12-05 09:16:59 +00:00
mgrettondann 4d6a0683bf Make 2402 part 2 more idiomatic. 2024-12-04 16:28:58 +00:00
mgrettondann 003fac75d6 2024 day 4 part 2.
Not happy with this part - not so functional.
2024-12-04 15:30:05 +00:00
mgrettondann 374a16befe 2024 day 4 part 1. 2024-12-04 09:24:45 +00:00
mgrettondann 4c41fd05f5 Comments and function renames. 2024-12-03 16:32:14 +00:00
mgrettondann 1f99f23c92 Use variants for day 3. 2024-12-03 15:38:53 +00:00
mgrettondann 2ee7f6a3d3 Rename functions to be more idiomatic. 2024-12-03 08:53:02 +00:00
mgrettondann 5d99f413de 2024 day 3 part 2. 2024-12-03 08:28:34 +00:00
mgrettondann d57ffe17cb 2024 Day 3 part 1 2024-12-03 08:08:45 +00:00
mgrettondann efdde2441b Add a generic main function. 2024-12-02 09:46:15 +00:00
mgrettondann 85bccdec58 Add day 2402. 2024-12-02 08:40:32 +00:00
mgrettondann dea764fc17 Tidy up day 1 solution 2024-12-01 18:05:21 +00:00
mgrettondann 262c7b7e1e 2024 day 1 solutions 2024-12-01 09:10:51 +00:00