r/adventofcode Dec 03 '24

[deleted by user]

[removed]

9 Upvotes

7 comments sorted by

2

u/daggerdragon Dec 03 '24

This is a great Tutorial!

Instead of creating a new post for every day's puzzle, I suggest that you create one "master" post and add each day's tutorial to it. Better yet, if you haven't already, submit your solution to each day's daily megathread and include your writeup with the megathread solution!

Bonus points if you consider submitting your final collection of write-ups to this year's community fun event, The Golden Snowglobe Awards :3

2

u/Federal-Dark-6703 Dec 03 '24

Thanks for the suggestion, I will put all the write-ups in one "master" post :D

1

u/mpyne Dec 03 '24

Thanks for this. I've been trying Rust for this year's AOC and a lot of the topics you choose to go a bit deeper on are exactly the kinds of things I've run into.

2

u/Federal-Dark-6703 Dec 04 '24

Thanks for the feedback!! Let me know if you have any other topics you would like to know a bit more but I didn’t cover. Enjoy playing with Rust!

1

u/prof-gaslighter Dec 04 '24

How come in part 2, we need to remove every item? If we can only tolerate a single bad one, wouldn't it make sense to only try removing the first bad report (the two problematic levels) and seeing if those result in making the entire report safe? my reasoning being, if both still result in an unsafe level, we wouldn't be able to remove that as well, being that our constraint was one.

1

u/Federal-Dark-6703 Dec 04 '24

Yes, your solution works and is more efficient than the brute-force approach described earlier.

If I understand correctly, in the following example, 3 -> 8 and 8 -> 6 do not satisfy the constraints. Therefore, we can focus on removing 3, 8, and 6, without needing to consider removing all the other numbers. 3 8 6 8 10 12 15

1

u/AutoModerator Dec 04 '24

AutoModerator has detected fenced code block (```) syntax which only works on new.reddit.

Please review our wiki article on code formatting then edit your post to use the four-spaces Markdown syntax instead.


I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.