Commit Graph

17 Commits

Author SHA1 Message Date
MasterofJOKers ae6ac6979a day09: Add part 1 2022-12-24 14:29:57 +01:00
MasterofJOKers 2ffa87d872 day08: Adapt code for part 2
I could probably optimize that by getting the iterators for all 4
directions and then to the scan on each of them in a loop, but I'm with
with this right now.
2022-12-20 23:48:03 +01:00
MasterofJOKers 30c0c2b42f day08 Add part 1
Took multiple seconds to run, so I wonder if there's a more efficient
way to do this. Maybe would be better to have a Vec<Vec<usize>> instead
of putting all lines after each other.
2022-12-20 23:16:30 +01:00
MasterofJOKers bc3599fff0 day07: Changes for part 2
Now that we have the sizes of the directories in a list, it's quite easy
to work with them to get part 2 using Iterator functions.
2022-12-20 00:48:04 +01:00
MasterofJOKers 2620d59a8f day07 Add part 1
I don't know, it doesn't feel like this is proper code. Referencing the
same object multiple times is just so much of a hassle and this code
looks pretty unsafe with all the unwraps.

In the end it turns out that I don't need a tree, but need to iterate
over all directories instead, which is again something quite hard for
me, because I don't know how to build iterators "manually".
2022-12-20 00:42:40 +01:00
MasterofJOKers 01789441db day06: Make more generic and add part 2 with it
Part 2 is basically the same just with 14 chars instead of 4.
2022-12-19 14:38:32 +01:00
MasterofJOKers 035f8e86ac day06: Add part 1
Borrow-checker hindered me to keep the same HashSet around all the time
and just clear it, so it feels a little inefficient to have a new set
every time.
2022-12-19 14:34:02 +01:00
MasterofJOKers f083a70ae5 day05: Changes for part 2
I feel like there should be away for me to read from the back and move
things over directly instead of having a temporary Vec for it, but I'm
not sure how this would work with the owner-checking, so I didn't try.
2022-12-18 18:31:23 +01:00
MasterofJOKers 152773a0a9 day05: Implement part 1 2022-12-18 18:26:03 +01:00
MasterofJOKers 93e88b94b7 day04: Change implementation for part 2
This will print all overlapping ranges instead of only fully contained
ranges.
2022-12-18 16:55:34 +01:00
MasterofJOKers 57b95e8c2c day04: Add part 1
I'm not sure why this is so much to write. It feels like there should be
a more generic way to check this instead of duplicating those lines, but
maybe it's not worth it for 2 ranges ...
2022-12-18 16:52:45 +01:00
MasterofJOKers 6dfb583345 day03: Make it solve part 2 instead 2022-12-16 18:50:29 +01:00
MasterofJOKers 55038c87da day03: Add part 1 solution 2022-12-16 18:33:33 +01:00
MasterofJOKers 7b82a1f46b day02: Add part 2
I suspect there must be a better way which could present this more
generically e.g. if I could iterate over the enum somehow ...
2022-12-15 18:03:37 +01:00
MasterofJOKers 1001e9dd0f day02: Use iterator instead of temporary Vec 2022-12-15 17:46:34 +01:00
MasterofJOKers 60f4e24250 Add part1 of day02 2022-12-15 17:33:38 +01:00
MasterofJOKers e66d90983e Add day01 2022-12-15 16:58:38 +01:00