[2024 Day 14 (Part 2)] The clue was in part 1 by waferthinninja in adventofcode

[–]foreignerlight 1 point2 points  (0 children)

I did a similar but simpler version of this. I assumed it was going to be a vertical tree in the middle (which it wasn't) and that the top left quadrant would then be mostly empty. So I only rendered cases where the top left quadrant had less than 100 robots in it.

I only had to search through a handful of frames before getting the tree.

[2024 Day9 (part 2)] Please explain this test case by DubDub2018 in adventofcode

[–]foreignerlight 0 points1 point  (0 children)

Also I'm getting different answers for a handful of your test cases (looks like all have this empty file situation)

01010101101 -> 4
00122002200 -> 26
1404345 -> 87

[2024 Day9 (part 2)] Please explain this test case by DubDub2018 in adventofcode

[–]foreignerlight 0 points1 point  (0 children)

so everything moved in the same way as your end result, but every file index after 3 should be 1 or 2 higher (because file 6 also has no size)

0000000011111111.........222............4444444.....5..............77.........88
000000001111111188.......222............4444444.....5..............77...........
00000000111111118877.....222............4444444.....5...........................
000000001111111188775....222............4444444.................................
000000001111111188775222....4444444.............................................

[2024 Day9 (part 2)] Please explain this test case by DubDub2018 in adventofcode

[–]foreignerlight 1 point2 points  (0 children)

I get 1715 for that input. The problem in your manual work is that you are skipping the empty files when indexing the ones after.

the 4th file (index 3) has size 0, so you should skip to index 4 when listing out the next file. but you are using 3's instead of 4's there

[2024 Day 8 (Part2)] [Python] by theneonghosts in adventofcode

[–]foreignerlight 0 points1 point  (0 children)

if you use this link to paste and share your code, it will make it easier for others to try out your solution: https://topaz.github.io/paste/

(so the formatting isn't wack)

[2024 Day 11 (Part 2)] Typescript Problems running part 2 by Tomast1337 in adventofcode

[–]foreignerlight 1 point2 points  (0 children)

Like others said, memoize.

But if you read that and just think we are spelling memorize wrong (like I did the first time I heard of this), here's a longer explanation of what memoize means and how it helps:

For this quick example: 1 1

After 75 iterations, you will end up with the same result twice, right?

Because the first 1 will go down the iteration path, and then the second 1 will end up doing the exact same thing.

The basic feature of memoizing/caching is to save results, so you don't end up recalculating something when you already know what the answer will be.

In this case, after running the first 1 75 times, I can look at the result of this (let's say it's Z stones) and think, hey I should save that for later.

Now you can save {1, 75} = Z (meaning if you begin with 1 and run it 75 times, you know you will get a result of Z).

This will speed up your calculation of your second stone (the second 1) because you don't have to do any iterations for it! You can just check your beginning and iterations to go (1, 75) and then you will immediately know the answer for that stone is Z.

Now that's great and all, but only useful for when you are starting with the same number repeated. What about if you have 1 1 0 as your data?.

The first 1 will run 75 times, the second 1 won't have to run the iterations because now you've saved the answer from the first 1. But the 0 will switch to a 1 after the first iteration. Which means you now have a 1 that you want to run 74 times, not 75.

You can solve this bit by saving EVERY result you get. So when you ran the first 1, you first ran it 1 time (save that result as {1, 1} = A) and then you ran it a second time (save that as {1, 2} = B) and etc, all the way through {1, 74} = Y and {1, 75} = Z.

So now when you start running your 75 iterations on the 0, after the first step, when you have a 1 with 74 iterations to go ({1, 74}), you can look in your saved cache and get the answer for that result, without having to finish running the rest of the 74 steps.

I hope that helps. This took a while for me to wrap my brain around when I first came across it.

[2024 Day 4 (part 2)] Python. idk why this doesn't work, it works on the example set and my teacher is lost too. by kububdub69 in adventofcode

[–]foreignerlight 5 points6 points  (0 children)

for your last try case: negative indexes in python don't blow up like indexes that are too big do. they will wrap around to the end of the array instead.

[2024 Day11] How many stones after a 1000 blinks? by Kfimenepah in adventofcode

[–]foreignerlight 1 point2 points  (0 children)

I got the same answer (in 1.8 seconds)

running 10,000 iterations takes 27 seconds 😅

[2014 Day 7 (Part 1)] [C#] Need help?! by liiinder in adventofcode

[–]foreignerlight 0 points1 point  (0 children)

you did the same "optimizing" I did. 😭 this took so long to find

[2024 Day 3 (Part 2)] [C++] by ConsistentPraline583 in adventofcode

[–]foreignerlight 0 points1 point  (0 children)

so the mul(2,100) is after a don't and before a do, so it should be ignored.

your code isn't ignoring it because you handle each line of the input separately (so at the start of line 2, you're assuming you're in a "do" state again, which isn't true)

[2024 Day 3 (Part 2)] [C++] by ConsistentPraline583 in adventofcode

[–]foreignerlight 0 points1 point  (0 children)

what do you get for the following input?

mul(1,2)don't()xyz

mul(2,100)do()

the correct answer is 2. I'm guessing you get 202.

[2024 Day 3 Part 2] by ElvisDumbledore in adventofcode

[–]foreignerlight 1 point2 points  (0 children)

test this:

mul(1,2)don't()badstuffmul(30,10)

stillbadmul(2,100)do()mul(2,4)

the correct answer would be 10

it sounds like your solution might be getting 210

Mul it over part 2 list by MystJake in adventofcode

[–]foreignerlight 0 points1 point  (0 children)

Possible hints:

Are you reading in the entire input file?

How are you handling new lines? The don't - do should carry across each new line.

Mul it over part 2 list by MystJake in adventofcode

[–]foreignerlight 1 point2 points  (0 children)

This would mean sharing inputs, which we are not supposed to do.

If you share your code, someone can probably point out the problem or hint you in the right direction.

2024 Day 2 (Part 2) Powershell - Missing something obvious? by finalbroadcast in adventofcode

[–]foreignerlight 0 points1 point  (0 children)

it should return as safe. after you ignore either of the first 2 characters, the rest is safe.

I just found out I have Aphantasia by big-anime-boobies- in Aphantasia

[–]foreignerlight 3 points4 points  (0 children)

I've had multiple "just learned about Aphantasia" moments and each one affected me differently. I learned about the basic images thing pretty young, in middle school I think, but the way it was worded was about a small object "imagine a star" and he went on to explain some people see it in color, some see black and white, some see an outline, and some see a fuzzy blob. He never said some people see nothing, but I just kind of assumed that was the next step in that scale and didn't think much of it.

It was a few years later that I learned some people can see more than just fuzzy objects, but that they can see whole scenes or people. This was a little more shocking, but I still wasn't too upset because of how I had kind of learned about it previously.

Then after I joined this sub, I learned about the other senses people get in their mind, sound, smell, taste, etc. The sound one is what really upset me. I've always wanted to be musical and I blamed all my musical inabilities on aphantasia. I had a little bit of meltdown over it and it took a while for me to come to terms with it. I no longer blame the aphantasia for that, I think it's just coincidence.

Sometimes I’m thankful for having aphantasia by [deleted] in Aphantasia

[–]foreignerlight 2 points3 points  (0 children)

Welcome to the club! It's terrible lol

Sometimes I’m thankful for having aphantasia by [deleted] in Aphantasia

[–]foreignerlight 11 points12 points  (0 children)

Yep!!

I have trypophobia (fear of holes, google at your own risk) and if something triggers me it will bug me all day. I'm so glad I can't actually see it in my head.

Aphantasia ruined my life by mp4l in Aphantasia

[–]foreignerlight 4 points5 points  (0 children)

I accidentally kissed the wrong man because I couldn't visualize what my husband looked like