🦆 Everybody.Codes 2025 Quest 9 Solutions 🦆
Quest 9: Encoded in the Scales
- Keep top level comments as only solutions, if you want to say something other than a solution put it in a new post. (replies to comments can be whatever)
- You can send code in code blocks by using three backticks, the code, and then three backticks or use something such as https://topaz.github.io/paste/ if you prefer sending it through a URL
Link to participate: https://everybody.codes/
Haskell
Not particularly optimized but good enough.
Nim
Very messy bruteforce.
I've had some problems with parsing in part 2 - I didn't account for double digit numbers before dna sequences and that caused my code to work on example, but silently fail only on the real input. I've figured it out after ~30 minutes with some external help.
Part 3 runs in 700ms - not great, but not too bad either.
Full solution at Codeberg: solution.nim
Scheme/Guile
I was stuck on part 3 for a while, for not taking account that a child scale that I'm evaluating may already be a parent scale in some group.
Python
union find: nice! I was too lazy to use union find, so I brute forced merging of the families, it was fast enough :)
Yeah I've got the DSU algorithm ingrained because of the number of the times I had to practice it for coding rounds. I didn't need to do path compression and union by rank either but might as well.
Wow, your interviews were tough. I was never asked anything even remotely this difficult.
Rust