Unable to load image

Advent of Code 2022 : Day 9

grate filter edition

:#marseycapyhacker:

17
Jump in the discussion.

No email address required.

Instead of sharing code, I wonder: Whats the fastest way to do part 2? Its not hard to get Part 1 to O(N) time, but I gave up on Part 2 and did it in O(N^3) time lol. (Iterating over each tail piece for each tile moved for each move). I imagine you can do it in at least O(N^2) if you tried, tho

Jump in the discussion.

No email address required.

that's already a O(N^2) approach. O is worst case, and worst case u get a series of single move instructions where each direction is different.

or really O(NxM) cause instruction length and tail length are independent.

the fact you can optimize repeated instructions easily when tail length is 2 ... is not a big O complexity reduction, because repeated instructions does not represent worst case.

Jump in the discussion.

No email address required.

snakes @everyone @hbtz discuss

Jump in the discussion.

No email address required.

I'm not sure, look at that visualization, when you start backtracking and going in circles within the rope's bounding box, it does behave in a nontrivial ropelike fashion.

https://old.reddit.com/r/adventofcode/comments/zgq3nr/2022_day_9_rope_pull/

Jump in the discussion.

No email address required.

Link copied to clipboard
Action successful!
Error, please refresh the page and try again.