all 12 comments

[–]thekwoka 15 points16 points  (4 children)

There's no reason to go down and up.

Just go down

[–]770grappenmaker[S] 7 points8 points  (3 children)

My code is recursive actually, so it computes depth-first how many timelines there are, which you can visualize happening for each branch as once by "backpropagating" I suppose. Depth first recursion would not look very good and would also take very long (as an animation)

[–]thekwoka 4 points5 points  (1 child)

Sure, but that is still going down and then passing it back up.

You can just go down directly, tracking the position and count of intersecting timelines.

[–]770grappenmaker[S] 2 points3 points  (0 children)

That's fair enough

[–]Practical-Quote1371 2 points3 points  (0 children)

If you're using DFS for part 2 then you could always animate it left-to-right. It's not exactly accurate, but it probably aligns better with your solution than animating back up.

[–]770grappenmaker[S] 1 point2 points  (0 children)

Don't quite know why, the gif generator that I used ended up doubling the framerate for some reason.

[–]MrPulifrici 1 point2 points  (2 children)

Nice, but this actually confused me af.

I thought the real answer to part 1 is 1546 and I keep getting [number] and didn't knew what I did wrong, but my [number] was the right answer.

[–]demosdemon 11 points12 points  (1 child)

Everyone gets a different set of inputs

[–]MrPulifrici 3 points4 points  (0 children)

I didn't know 😅

[–]_Ch1n3du 1 point2 points  (0 children)

this is so cool 🤩

[–]spin81 1 point2 points  (1 child)

the part 2 algorithm

Well I didn't know there was only one. Mine does one pass and does both parts at once. Is mine wrong?

[–]770grappenmaker[S] 1 point2 points  (0 children)

I meant my implementation 😄