2025 Day 2 Part 1
This commit is contained in:
parent
af03b8491b
commit
81cb656a7f
1 changed files with 33 additions and 0 deletions
33
2025/day02.ua
Normal file
33
2025/day02.ua
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
~ "aoc.ua" ~ Lines
|
||||
|
||||
Input ← (
|
||||
&fras "input/day02.txt"
|
||||
°□ ⊢Lines
|
||||
⊜□ ⊸≠ @,
|
||||
)
|
||||
|
||||
ParseRange ← (
|
||||
⊜□ ⊸≠ @,
|
||||
⍚(⊂∩⋕°$"_-_")
|
||||
°□⊢
|
||||
)
|
||||
|
||||
Seq ← + ⊙⇡ ⟜(+1-)
|
||||
Log ← ⌝˜ⁿ
|
||||
NumDigits ← +1 ⌊ Log10
|
||||
RepeatDigits ← (
|
||||
⊸(˜ⁿ10 ÷2NumDigits)
|
||||
=⊃(⌊÷|◿)
|
||||
)
|
||||
ValidId ← (
|
||||
⊸(◿2 NumDigits)
|
||||
⨬(¬RepeatDigits|1)
|
||||
)
|
||||
|
||||
⍚ParseRange Input
|
||||
≡(
|
||||
♭Seq°⊂°□
|
||||
▽¬ ⊸ValidId
|
||||
/+
|
||||
)
|
||||
/+
|
||||
Loading…
Reference in a new issue