Last active
December 2, 2020 05:44
-
-
Save angus-g/be9d9c9de8a80385cd127778cddb9c9e 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
input=: cutLF fread '~Projects/advent/2020-day2.in' | |
valid=: verb define | |
'con char word'=. ' ' splitstring y | |
'min max'=. ". each '-' splitstring con | |
(min&<: *. <:&max) +/ ({. char) = word | |
) | |
valid2=: verb define | |
'con char word'=. ' ' splitstring y | |
i=. > ". each '-' splitstring con | |
~:/ ({. char) = (i - 1) { word | |
) | |
NB. part 1 | |
+/ > valid each input | |
NB. part 2 | |
+/ > valid2 each input |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment