Skip to content

Instantly share code, notes, and snippets.

@xpqz
Last active December 2, 2021 09:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xpqz/6e05b8fc54a6aa1876d32d5b18632ea5 to your computer and use it in GitHub Desktop.
Save xpqz/6e05b8fc54a6aa1876d32d5b18632ea5 to your computer and use it in GitHub Desktop.
Advent of Code 2021, ngn/k
/ day 1
d:`I$0:"../d/1"
+/>':d
+/(-3_d)<3_d / no need to sum the 3-window
/ day 2
d:" "\'d:0:"../d/2"
mag:`I$d[;1];dir:d[;0]
m:(("forward";"down";"up")~/:\:dir)*\:mag
s:+/'m;s[0]*s[1]-s[2]
(+/(-/+\'1_m)*m@0)*+/m@0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment