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

comments

aylac.top 2f792f59 168d56a0

verified
Changed files
+3 -1
2025
3
gleam
+3 -1
2025/3/gleam/src/main.gleam
··· 25 // and then we get the highest number 26 // and done here 27 // little assert because failing is better than the silent failing of unwrap 28 let assert Ok(#(max, loc)) = 29 bank 30 |> list.reverse ··· 37 // i wasn't using this number trick when i was doing it, i was literally just finding a power of 10 and multiplying it but like the power thing in gleam sucks it's like float only. i now learned this trick from *someone* and will be using it. don't know how i didn't figure out myself. oh wait i do it's because i'm stupid 38 // but yeah it just multiplies the number by ten so like 4 becomes 40 and then we add our like 3 to it 43 and then 43 to 430 and the 5 you get the gist of it. again don't know how i didn't see it myself 39 // and then we drop the parts of the list that can't be used for the subsequent numbers. like off by one evil thing in here to not include the number we just used too 40 - // wky don't we add 1 to everything in the thing above? because that would be more math than just adding it only once here duh 41 #(number * 10 + max, list.drop(bank, loc + 1)) 42 }) 43 // and then like every advent of code we add it to the acc
··· 25 // and then we get the highest number 26 // and done here 27 // little assert because failing is better than the silent failing of unwrap 28 + // list.take instead of drop would allow me to do it without reversing two times but like it would also need list.length which also goes through the whole list but without letting me put it in just pipes 29 + // i mean i COULD count it once when starting it when then after getting the location subtracting from it but meh already did the rust version and this would put too much stuff on here 30 let assert Ok(#(max, loc)) = 31 bank 32 |> list.reverse ··· 39 // i wasn't using this number trick when i was doing it, i was literally just finding a power of 10 and multiplying it but like the power thing in gleam sucks it's like float only. i now learned this trick from *someone* and will be using it. don't know how i didn't figure out myself. oh wait i do it's because i'm stupid 40 // but yeah it just multiplies the number by ten so like 4 becomes 40 and then we add our like 3 to it 43 and then 43 to 430 and the 5 you get the gist of it. again don't know how i didn't see it myself 41 // and then we drop the parts of the list that can't be used for the subsequent numbers. like off by one evil thing in here to not include the number we just used too 42 + // why don't we add 1 to everything in the thing above? because that would be more math than just adding it only once here duh 43 #(number * 10 + max, list.drop(bank, loc + 1)) 44 }) 45 // and then like every advent of code we add it to the acc