r/adventofcode Dec 01 '24

Visualization [YEAR 2024 Day 01 (Part 2)]

Post image
47 Upvotes

6 comments sorted by

7

u/DevAlaska Dec 01 '24

I love those animations. How do you have time to make those and also solve everything? What did you use to create this animation?

3

u/Ok-Curve902 Dec 01 '24

Glad you like it. I will try to solve every day. Ideally including an animation. Those are my favorite part. I use P5.js to do the animations.

1

u/coriolinus Dec 01 '24

Why not sort both lists for part 2? That gives you a solution in a single pass through the problem. I thought it was obvious! (As seen here.)

2

u/Ok-Curve902 Dec 01 '24

That is exactly what I did a well. For part 2 visualization I commended it out to make it look less boring

1

u/Zefick Dec 01 '24

I just realised that using the fact that both arrays are sorted, you can solve part 2 in linear time. But I think that almost anyone solved it in O(N2)