Advent of Code 2024 - Day 1

https://adventofcode.com

This is a thread to discuss Day 1 (which started on 1st December at 05:00 UTC ) :slight_smile:

https://adventofcode.com/2024/day/1

REMEMBER!
It is VERY important NOT to write any public spoilers :slight_smile:
ALWAYS keep spoiler stuff hidden inside one of these

Summary

This text will be hidden

which you can obtain by clicking on the gear icon

image

Good luck :slight_smile:
FYI one of the features of Advent of Code is that we all get given different inputs so our answers will be different.
The examples are all the same but each of us gets different inputs for us to solve

you put the link for 2023 day one and not the 2024 one

sorted now thanks :slight_smile:

Summary

I've tidied up my part 1 solution now - forgot that I had a custom block designed to join lists together in columns

https://snap.berkeley.edu/snap/snap.html#present:Username=cymplecy&ProjectName=aoc2024_01&editMode

Do all their puzzles have such ornate stories?

And, are there rules about the programming language features you can use, e.g., are you allowed to use untitled script pic (7)?

The stories are always ornate and convoluted with a different theme each year :slight_smile:

There are no restrictions on any programming features or languages (except using LLMs)

Here is my part 1 and part 2 solution

Summary

are you sure you want to see my solution?

Yes

Are you super duper sure?

"Yes

Part 1:


Part 2:
Screenshot 2024-12-01 134904

I know its super untidy but I not good at code lol.

Congrats on coming up with a solution that works :slight_smile:

Part 1

This is possibly the easiest challenge I've done in advent of code ever.

As soon as I read that the smallest of each list is paired up together, I knew to just sort both lists and find the difference. Getting the absolute value was just found by testing the result, because the example doesn't account for negative differences.

Part 2

This my first version

I then thought that this might be faster, but I'm not sure if it really is faster.

project

Snap! Build Your Own Blocks

If anyone wants, I have a snap leaderboard for advent of code. Just enter this code

1492847-2e9c76cd

Into Leaderboard - Advent of Code 2024

My name is "My2ndaccount acount" on leaderboard due to gmail account I made when I was 8. Is there anyway to change name on leaderboard?

No idea sorry

I think the only way is to either use the anonymous name, which you can set on the settings page, or create a github account, and transfer your data to a new advent of code account that logged in with your new github account (you can transfer from the settings page).

Ok I did it through github

image
What is the top row of numbers on the leaderboard for?

Those indicate what star goes to what day. It'll probably make more sense tomorrow.

Here are my solutions for day 1 (in a custom block, as not to spoil the solutions for everyone)
AoC 2024 script pic (1)
AoC 2024 script pic (2)
I also made a block to turn the text into a list for the above two blocks:
AoC 2024 script pic (3)

oh i thought it was to indicate 2 digit dates. like 10, 23, or 99

it is

How do we use the two blocks?

What goes into the empty slots?

Like this:
AoC 2024 script pic (4)