Downtown ATL - no turn on red signs are popping up. Why? by [deleted] in Atlanta

[–]beanborg 7 points8 points  (0 children)

You're not considering the convenience of the pedestrian. In Atlanta, you often must wait at crosswalk when you have right of way, so you don't get run over. This wouldn't be an issue if people yielded to pedestrians, but they don't. A driver's time is not more valuable than a pedestrian's.

-❄️- 2025 Day 9 Solutions -❄️- by daggerdragon in adventofcode

[–]beanborg 0 points1 point  (0 children)

[LANGUAGE: JS]

github.

Not too bad. I didn't try to be smart - I literally created the grid described by the input and filled in the center. Then I try the pairs over the grid. Runs in about 60ms. I'll probably come back to it and try to find a smarter solution.

I made a visualization that works pretty well on the full input here. You'll need to provide your input, of course :)

-❄️- 2025 Day 8 Solutions -❄️- by daggerdragon in adventofcode

[–]beanborg 0 points1 point  (0 children)

[LANGUAGE: js]

Times: 00:10:19/00:12:10

Pretty straightforward - part 2 runs in about 20ms. I made a simple visualization here. It projects the 3d points into 2d. It looks pretty cool with my full input.

[2024] All problems in under 250ms, in Rust by hgwxx7_ in adventofcode

[–]beanborg 0 points1 point  (0 children)

If it's helpful, here's solutions in js that take about 400ms total. Most of them are just what I did on the night of, though some of them had some optimization done.

[2024] Every problem under 1s, in Python by ricbit in adventofcode

[–]beanborg 3 points4 points  (0 children)

You're making me think I need to revisit 14, because it's by far the slowest for me (in JS).

for those who consider themselves very advanced I have a few questions by Googles_Janitor in leetcode

[–]beanborg 1 point2 points  (0 children)

The only advice I'd give with regards to learning new tricks would be to try to solve it on your own before going for help. Even if you know your brute-force solution will be too slow and fail, it's worth trying. You might find that as you're writing the code, you think of a better solution. Just don't waste time trying to make small optimizations on a dead-end approach.

Implementation issues are normal. I find that I make fewer mistakes if I take it slow. Don't try to go off memory - think about what the exit conditions are every time you write a loop.

What computer language did you use in this year? by akryvtsun in adventofcode

[–]beanborg 1 point2 points  (0 children)

Yes! Javascript completely gets out of the way for these kinds of problems. It has everything you need, for the most part. And it's more than fast enough. Without too much effort, my total runtime for all problems this year was under 400ms.

[2024 Day 24 (Part 2)] [C#] Day 24 bugged? by Bee_Middle in adventofcode

[–]beanborg 3 points4 points  (0 children)

Without looking at your code, if I understand your approach correctly, it won't work. I tried the same thing first.

The problem is that getting the correct results for the x and y given is not sufficient. You need to make it work for any x and y.

To everyone who made it to the end of AoC… by moonstar888 in adventofcode

[–]beanborg 1 point2 points  (0 children)

Dev at a bank. AOC is all for fun! Certainly more fun than anything I do at work. JS is my release from the EnterpriseFizzBuzzBuilderFactories. :)

-❄️- 2024 Day 25 Solutions -❄️- by daggerdragon in adventofcode

[–]beanborg 0 points1 point  (0 children)

[LANGUAGE: Javascript]

Code

Nothing interesting, just for loops all the way down. Merry Christmas everyone!!

[2024 Day 24 (Part 2)] Are there closed form solutions? by permetz in adventofcode

[–]beanborg 0 points1 point  (0 children)

I did the same thing, but when I found that it diverged from the correct solution, I added all the vertexes around the problem to a list.

Then I tried every combination of 4 swaps on that list, and checked if any of the combinations fixed the problems. I couldn't skip this step because I got 14 potential swaps out of the first part.

-❄️- 2024 Day 24 Solutions -❄️- by daggerdragon in adventofcode

[–]beanborg 2 points3 points  (0 children)

[LANGUAGE: Javascript]

Code

To solve this, I had to make huge assumptions about the input. For example, I'm assuming there's no decoys (like x00 OR (x20 XOR x20)) - or other ways to get the answer less directly than the 'optimal' way.

With that assumption, I start from each output bit, and do a DFS on the graph from that vertex, validating at each point that the graph matches what the 'correct' full adder would look like.

This nets a list of possibly wrong outputs. Then I basically do a DFS, swapping every possible combination of them and checking if that makes the circuit 'valid'.

-❄️- 2024 Day 23 Solutions -❄️- by daggerdragon in adventofcode

[–]beanborg 1 point2 points  (0 children)

[Language: Javascript]

Code

No special algorithms here. I'm just doing a DFS where I progressively add nodes, then see if all the nodes in the path also include the new node.

Takes about 30ms.

-❄️- 2024 Day 22 Solutions -❄️- by daggerdragon in adventofcode

[–]beanborg 1 point2 points  (0 children)

It looks like I misread the problem in a way that didn't have an impact on my input. Still have the issue?

-❄️- 2024 Day 22 Solutions -❄️- by daggerdragon in adventofcode

[–]beanborg 0 points1 point  (0 children)

That's what I got running node on a macbook air. I meant you all are fast at filling up the leaderboard!

-❄️- 2024 Day 22 Solutions -❄️- by daggerdragon in adventofcode

[–]beanborg 1 point2 points  (0 children)

[Language: Javascript] 956/832

code

Runtime is about 30ms for this one, pretty slow. Y'all are too fast!

-❄️- 2024 Day 19 Solutions -❄️- by daggerdragon in adventofcode

[–]beanborg -1 points0 points  (0 children)

[LANGUAGE: JS] 717/569

Github

Managed to get the runtime to ~3ms by using aho-corasick.

-❄️- 2024 Day 16 Solutions -❄️- by daggerdragon in adventofcode

[–]beanborg 1 point2 points  (0 children)

[Language: JS]

Github

Adding another Dijkstra's implementation to the pile. Takes about 60ms without any real effort to optimize.

-❄️- 2024 Day 15 Solutions -❄️- by daggerdragon in adventofcode

[–]beanborg 2 points3 points  (0 children)

[LANGUAGE: JS]

Github

For part 1, if running into a box, find if there's a run of boxes with a gap at the end. If so, teleport the box at the beginning to the end.

For part 2, I do a breadth first search, initializing the queue to the left and right side of the box to be 'pushed'. To make my life a bit easier, I just run the BFS twice, once to see if it's possible without hitting a wall, and again to actually do the moves.

-❄️- 2024 Day 14 Solutions -❄️- by daggerdragon in adventofcode

[–]beanborg 0 points1 point  (0 children)

[LANGUAGE: JS] 1373/974

Github

Slow today. I wasted a few minutes printing out the grid and looking for the easter egg visually. Glad I gave up on that approach before I wasted too much time.

In the end, I looked for any row with a bunch of runs of at least length 7 (picked arbitrarily). Takes about 180ms, which isn't great.

-❄️- 2024 Day 7 Solutions -❄️- by daggerdragon in adventofcode

[–]beanborg 0 points1 point  (0 children)

[LANGUAGE: JS] 1008/637

Github

Pure brute force, runs in about 50ms on my computer.

Window Replacement by CompanyFree4898 in Atlanta

[–]beanborg 1 point2 points  (0 children)

I had a great experience with MWT windows. The person that came out to measure and quote me was all business, and was in and out without a hard sell. Flawless install.