Last active
December 10, 2021 17:02
-
-
Save xpqz/d7ffa9c4aa90a299368ffb2800f1762d to your computer and use it in GitHub Desktop.
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
⍝ Blatantly plagiated from @rak1507 | |
data←↑⍎¨¨⊃⎕NGET'../d/9'1 | |
shifts←{(⍺,2⊣/⍵)(2⊢/⍵,⍺)(2⊢⌿⍵⍪⍺)(⍺⍪2⊣⌿⍵)} | |
lowpoints←data<⊃⌊/10 shifts data | |
+/1+data[⍸lowpoints] ⍝ part 1 | |
fill←{(×⍵)×⍵⌈⊃⌈/0 shifts ⍵}⍣≡{(2+⍳+/,⍵)@⊢⍵}9≠data | |
×/3↑{⍵[⍒⍵]}⊢∘≢⌸(∊fill)~0 ⍝ part 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment