Created
December 5, 2020 09:42
-
-
Save xpqz/6f8c2445e365edfa6c4e0fbc05cd5154 to your computer and use it in GitHub Desktop.
AoC 2020 Day05 Dyalog APL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DAY05←⊃⎕NGET'data/2020/day05.txt'1 | |
SID←{0=≢⍵:⊃⍺⋄(lo hi)←⍺⋄half←hi÷2⋄(0⊃⍵)∊'FL':(lo,half)∇1↓⍵⋄((lo+half),half)∇1↓⍵} | |
⌈/s←0 1024∘SID¨DAY05 | |
gap←⍸~2{⍵=⍺+1}/sorted←s[⍋s] | |
1+gap⊃sorted |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment