advent-of-code/2022/day01/day01.bqn
2024-11-12 21:46:18 +01:00

7 lines
353 B
BQN
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.

P(10×+˜´0-'0') # string->number, 0 for empty string
iP¨¨(+`0=¨)•FLines"input" # parse input as list of lists
# Alternative version, with bqn-libs
#str ← •Import"../bqn-libs/strings.bqn"
#i ← str.ToNats¨ (2⥊@+10) str.Split •FChars"input"
•Show ´+´¨i # part 1
•Show +´3+´¨i # part 2