I just completed "Disk Fragmenter" - Day 9 - Advent of Code 2024 #AdventOfCode https://adventofcode.com/2024/day/9
(mine #rust https://github.com/robbiemu/advent_of_code_2024/blob/main/day-9/src/lib.rs
I got a very performant O(n) solution for part1. I tried a couple of ways around getting part2 to also be O(n), but I key finding subtle issues that meant random access in a hash or else sorting, ie, O(n log(n)), so I just rewrote it to sort. 45μs for part 1, 25ms for part 2 -- probably both could have been faster, but for me, this was made me proud.
=> More informations about this toot | More toots from robbiemu@mastodon.social
text/gemini
This content has been proxied by September (3851b).