Ancestors

Toot

Written by Robbie on 2024-12-10 at 00:41

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

Descendants

Proxy Information
Original URL
gemini://mastogem.picasoft.net/thread/113625746451148032
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
236.694479 milliseconds
Gemini-to-HTML Time
0.447561 milliseconds

This content has been proxied by September (3851b).