Skip to content

Instantly share code, notes, and snippets.

@lokedhs
Created December 6, 2021 15:53
Show Gist options
  • Save lokedhs/15d28fe89c755b4617a73dc156ed83e9 to your computer and use it in GitHub Desktop.
Save lokedhs/15d28fe89c755b4617a73dc156ed83e9 to your computer and use it in GitHub Desktop.
∇ d iterateValues content {
c ← content
i ← 0
while((i < 12) ∧ 1<≢c) {
col ← c[;i]
b ← ⍞d (2÷⍨≢col) ≤ +/col
c ← c[(col=b)/⍳≢col;]
i ← i+1
}
2⊥,c
}
∇ solvePart2 {
filecontent ← io:read "part03.txt"
content ← @1= ⊃ filecontent
a ← λ⊣ iterateValues content
b ← λ~ iterateValues content
a × b
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment