AOC 2022 Day Four #759
Replies: 10 comments 31 replies
-
I have done ... a lot of geospatial work in my day. I think I need at least both hands if not two hands and a foot to count the number of times I've had to rewrite range inclusion/intersection logic. So I did this functional-style, but slow, because I have a lot of other crap to do today! |
Beta Was this translation helpful? Give feedback.
-
JS: https://github.com/clandau/advent-of-code/blob/main/2022/day-4/index.js |
Beta Was this translation helpful? Give feedback.
-
Here's my ts solution! https://github.com/danieltott/aoc2022/blob/main/src/day04/index.ts I also did a pull request this time to see the steps and stuff. I wanted a way to save the state of the part one solution, but it turns out I didn't really need to change anything this time for part 2. Still I think it's kinda fun (: |
Beta Was this translation helpful? Give feedback.
-
I'm shocked that it's day 4 and we haven't needed any crazy optimizations yet. Part 2 was more straightforward than 1 today imo |
Beta Was this translation helpful? Give feedback.
-
fell asleep last night early before the problem dropped, then woke up and couldn't wait for @tkshill; had to get this one done before my day kicked off. F# is really nice for working with sets and matrices as it comes with libraries that do all the heavy lifting and the paradigm is all about composing functions together to express the domain:
I started with fewer pieces and wound up with more functions, more lines of code, but each function is smaller and simpler. maybe. the first one seems easier to understand to me. in the second one I can focus on the solution which is very small and very declarative, though in order to understand how it's implemented it you need to read many of the helpers... |
Beta Was this translation helpful? Give feedback.
-
Ruby I'm playing around with refactoring this one. Here's the commit with my original solution: danimeyer/advent-of-code@5e56445 And then here's the code in my repo. I want to try using some more ruby methods in my solution: https://github.com/danimeyer/advent-of-code/blob/main/2022/4.rb |
Beta Was this translation helpful? Give feedback.
-
This timezone makes me feel like I'm always behind 😢 Time to read your lovely solutions. My Solution here. Came out pretty clean? Tried to figure out part 2 with maths but said screw it, sets never fail me. Took some time to debug, but shoutout to tests and scripting 😄 Edit: Realizing now that both of these could've been done with sets or just comparisons, so I guess each of my parts shows one or the other. |
Beta Was this translation helpful? Give feedback.
-
A very late ruby solution from me today. I spend a lot of time misunderstanding how the input data was coming in without actually looking at it. Also, today was tree decorating day so didn't get a chance to really finish thinking til now. |
Beta Was this translation helpful? Give feedback.
-
The quickest and obvious solution, still not optimising nothing 😭 https://github.com/BogDAAAMN/advent-of-code-2022/blob/main/day-04.js |
Beta Was this translation helpful? Give feedback.
-
Yay, day1 in |
Beta Was this translation helpful? Give feedback.
-
Discussion of solutions for Advent of Code Day 4 here
VC Advent of code leaderboard
Go to leaderboard/private and use join code 363496-e6f42283
Beta Was this translation helpful? Give feedback.
All reactions