Alpha Chen 1 year ago
parent b8cd0faa3e
commit c87d7854bf
Signed by: alpha
SSH Key Fingerprint: SHA256:3fOT8fiYQG/aK9ntivV3Bqtg8AYQ7q4nV6ZgihOA20g

@ -2,6 +2,6 @@ Input ← &fras "../day_01.txt"
Lines ← ⊜□≠, @\n Input
Digits ← +@1⇡9
CalibrationValue ← /+ ×[10 1] -@0 ⊏0_¯1 ▽ ≡/+ ∵(⌕:Digits).
CalibrationValue ← /+ parse ⊏0_¯1 ▽≡/+ ∵(⌕:Digits).
/+ ∵(CalibrationValue ⊔) Lines
/+ ∵CalibrationValue Lines

@ -0,0 +1,4 @@
&fras "../day_04.txt"
# 36 numbers per card is 1 card id, 10 winning numbers, and 25 card numbers
/+≡(⌊ⁿ:2-1/+∊⊃↙↘10↘1) ↯¯1_36 ∵(parse⊔) regex "\\d+"

@ -0,0 +1,9 @@
Input ← regex"\\d+" &fras "../day_06.txt"
# part one
Races ← ⍉↯2_¯1 ⊐∵⋕ Input
/×≡(/+<×⊙-.⇡.⍘⊟) Races
# part two
Races ← ∵⋕⊐≡/⊂ ↯2_¯1 Input
/+<×⊙-.⇡.⍘⊟ Races
Loading…
Cancel
Save