Skip to content

Instantly share code, notes, and snippets.

@xpqz
Last active December 2, 2020 15:59
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/e455740b14338a43ad226603e3b1e437 to your computer and use it in GitHub Desktop.
Save xpqz/e455740b14338a43ad226603e3b1e437 to your computer and use it in GitHub Desktop.
Ungolfed
DAY02←⍎¨@1 2¨'- :'∘segs¨⊃⎕NGET'data/2020/day02.txt'1
Part1←{
(min max letter string)←⍵
count←+/letter=string
(min∘≤∧≤∘max) count
}
Part2←{
(min max letter string)←⍵ ⍝ De-structure
⊃(letter=min⊃string)≠(letter=max⊃string) ⍝ Pick the values, and XOR
}
+/Part1¨DAY02
+/Part2¨DAY02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment