advent-of-code/2020/day09/day09.dyalog
2024-11-12 21:46:18 +01:00

6 lines
289 B
APL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

⎕IO0
p¨⎕NGET'input'1
m25
xpm+~(mp)¨{(,.<m)/,}¨.+¨¯1m,/p ⍝ Part 1
⍝+/∊{{(x=+/⍵)×(⌈/+⌊/)⍵}¨⍵,/p}¨2+p ⍝ Part 2
(/+/)p[{(1+1)+-/}x=.-+\p] ⍝ Part 2 (faster)