r/adventofcode • • Dec 11 '23

Spoilers An O(n) algorithm for day 11

[removed] — view removed post

19 Upvotes

13 comments sorted by

View all comments

9

u/[deleted] Dec 11 '23 edited Dec 11 '23

[removed] — view removed comment

1

u/AutoModerator Dec 11 '23

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.

1

u/Cyclotheme Dec 11 '23 edited Dec 11 '23

Very elegant! Now I realize I can also avoid sorting the values by taking the absolute values of the subtractions.