my solutions to advent of code
aoc advent-of-code

ok i wasnt the one who came up with this

aylac.top fb83ec26 3238299d

verified
Changed files
+4 -11
2025
3
gleam
+4 -11
2025/3/gleam/src/main.gleam
···
-
import gleam/float
import gleam/int
import gleam/io
import gleam/list
···
input
|> list.fold(0, fn(acc, bank) {
let #(n, _) =
-
list.range(digits, 1)
+
list.range(digits - 1, 0)
|> list.fold(#(0, bank), fn(acc, i) {
let #(number, bank) = acc
+
let bank_find =
bank
|> list.reverse
-
|> list.drop(i - 1)
+
|> list.drop(i)
|> list.reverse
let max =
···
|> list.key_find(max)
|> result.unwrap(0)
-
#(
-
number
-
+ max
-
* float.round(
-
int.power(10, int.to_float(i - 1)) |> result.unwrap(0.0),
-
),
-
list.drop(bank, max_loc + 1),
-
)
+
#(number * 10 + max, list.drop(bank, max_loc + 1))
})
acc + n
})