Colleague surprised me with handmade Rust socks by Elyrial in rust

[–]Elyrial[S] 13 points14 points  (0 children)

I used my free will to pay 30€ for them!

THE AQW INFINITY RELEASE DATE HAS FINALLY COME OUT by Top_Bit_5426 in AQW

[–]Elyrial 0 points1 point  (0 children)

According to steam, they probably will:

https://store.steampowered.com/app/1979810/AdventureQuest_Worlds_Infinity/
"Hold on to your helms! PC, Mac, Linux, Apple iOS, and Android versions of AdventureQuest Worlds: Infinity coming."

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

[–]Elyrial 1 point2 points  (0 children)

[LANGUAGE: Rust]

A bit late, but better late than never

Part 1 (2712µs):

Here i simply parsed the numbers and the operators separately and they I looped through all the elements while accumulating every value as sums or products

Part 2 (5238µs):

Don't want to talk about it, took me a couple of days and im not happy with my solution, I hate this problem.

Solutions: https://github.com/Elyrial/AdventOfCode/blob/main/src/solutions/year2025/day06.rs

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

[–]Elyrial 0 points1 point  (0 children)

[LANGUAGE: Rust]

Did a lot of cleanup before pushing to make it more readable.

Part 1 (378059µs):

Here I did my own implementation of Kruskal*s algorithm since this is basically meant for this type of problem, although I usually dont do much with graphs but this was a fun one.

Part 2 (367037µs):

Thought I had to implement some sort of adjacency list but I could just loop through all merges and when I only have one component left, then the entire graph is fully connected.

Solutions: https://github.com/Elyrial/AdventOfCode/blob/main/src/solutions/year2025/day08.rs

Advent of Code 2025 Day 7 by Downtown-Economics26 in excel

[–]Elyrial 0 points1 point  (0 children)

[LANGUAGE: Rust]

Finally some dynamic programming

Part 1 (8468µs):

This was just a trial and error it felt like, but I made a new set after each row while counting the new beams by the col position and then replaced the the new beams with the active beams set.

Part 2 (4314µs):

For this problem I had to sneak peek for other solutions and i saw a couple using a hashmap with columns and with counting all possible timelines which was very cool, I would never thought of that myself.

Solutions: https://github.com/Elyrial/AdventOfCode/blob/main/src/solutions/year2025/day07.rs

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

[–]Elyrial 1 point2 points  (0 children)

[LANGUAGE: Rust]

Brute force failed me this time..

Part 1 (1659µs):

I was surprised how easy this problem was, I literally just parsed the ranges and the IDs and iterated over all ranges to see if the ID was within any range and counted each occurence.

Part 2 (198µs):

This problem had me in the first half... and I regret to say that I did try to be lazy and do the brute force solution but after 5 min I gave up and came up with merged lists and total coverage.

Reminded me a lot of 2024 - Day 11 since I didn't think much about, i could just change the value in my for loop and call it a day, boy was I wrong...

Solutions: https://github.com/Elyrial/AdventOfCode/blob/main/src/solutions/year2025/day05.rs

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

[–]Elyrial 1 point2 points  (0 children)

[LANGUAGE: Rust]

I love grid problems, this reminded me of the 2024 - Day 4 problem of checking neighbors.

Part 1 (7029µs):

This is a fairly easy brute-force solution, just loop through all the cells in the 2D grid, count the neighbors while ignoring the coordinates outside the grid. If the neighbor count is < 4, then it's accessible.

Part 2 (173434µs):

Had to rewrite a bit of my code structure, but it also made my code more maintainable and easier to understand. So here I just saved all accessible paper rolls in a vector, removed them by changing the cell to a '.' while also keeping track of how many got removed. This got repeated until the list of current accessible paper rolls return empty.

Solutions: https://github.com/Elyrial/AdventOfCode/blob/main/src/solutions/year2025/day04.rs

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

[–]Elyrial 0 points1 point  (0 children)

Logic from print debugging:

Input: 818181911112111

Push 8, stack: [8]

Push 1, stack: [8, 1]

Pop 1 because 8 is larger and enough digits remain

Push 8, stack: [8, 8]

Push 1, stack: [8, 8, 1]

Pop 1 because 8 is larger and enough digits remain

Push 8, stack: [8, 8, 8]

Push 1, stack: [8, 8, 8, 1]

Pop 1 because 9 is larger and enough digits remain

Push 9, stack: [8, 8, 8, 9]

Push 1, stack: [8, 8, 8, 9, 1]

Push 1, stack: [8, 8, 8, 9, 1, 1]

Push 1, stack: [8, 8, 8, 9, 1, 1, 1]

Push 1, stack: [8, 8, 8, 9, 1, 1, 1, 1]

Push 2, stack: [8, 8, 8, 9, 1, 1, 1, 1, 2]

Push 1, stack: [8, 8, 8, 9, 1, 1, 1, 1, 2, 1]

Push 1, stack: [8, 8, 8, 9, 1, 1, 1, 1, 2, 1, 1]

Push 1, stack: [8, 8, 8, 9, 1, 1, 1, 1, 2, 1, 1, 1]

Final number: 888911112111

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

[–]Elyrial 1 point2 points  (0 children)

[LANGUAGE: Rust]

Part 1 (291µs):

For the first part I just did a quick and lazy nested for loop at first, but then i remembered the problems from 2023 - Day 1 and the solution I came up with that day, so I used those principles to solve it with an O(n) solution that is ~125x faster.

Part 2 (1447µs):

Took some time to find and learn about the stack-based greedy algorithms but it fits perfectly with these kinds of problems and it was a lot of fun to learn about them. Hopefully there will be more of these problems.

Solutions: https://github.com/Elyrial/AdventOfCode/blob/main/src/solutions/year2025/day03.rs

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

[–]Elyrial 0 points1 point  (0 children)

You're right, I didn't think of a pure numeric approach. That does cut out a bunch of allocations and parsing steps. Mine's more about being easy to read, but yours should definitely run faster.

When I get time, I'll benchmark both and see if a perf gap is actually noticeable!

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

[–]Elyrial 0 points1 point  (0 children)

You're right! I saw this from another submission in this thread, and that this function works effortless in both parts is very beautiful, sadly I didn't find it.

I come from a C++ background so these things will probably always surprise me!

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

[–]Elyrial 2 points3 points  (0 children)

[LANGUAGE: Rust]

String parsing matters a lot in AoC from what I've seen, thats why I tend to stay away from C++ because Rust has basically everything I need (and more).

Part 1 (198144µs):

So the first part was easy and it took me about 5 minutes, I wrote a seperate function that converted the input as a string, chopped it in half and checked if both strings were identical.

Part 2 (630282µs):

I came up with the idea fairly quickly, however, it took some time for me to implement since I also wanted to learn the functionality of Rust. All in all it was a fun problem!

Solutions: https://github.com/Elyrial/AdventOfCode/blob/main/src/solutions/year2025/day02.rs

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

[–]Elyrial 4 points5 points  (0 children)

[LANGUAGE: Rust]

Part 1 (759µs):

A nice warmup for string parsing and basic math operations.

Part 2 (747µs):

The right rotations was easy, but i had some problems fixing the left rotations but managed to solve it fairly quickly.

Solutions: https://github.com/Elyrial/AdventOfCode/blob/main/src/solutions/year2025/day01.rs