Quest 6: Mentorship Matrix
- 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/
6 Comments
hades@programming.dev · 3 pts · 267d
Rust
mykl@lemmy.world · 3 pts · 266d
Uiua
Straightforward until part3. I left the naive approach running while I put together the version below, but of course the better algorithm got there first.
lwhjp@piefed.blahaj.zone · 2 pts · 267d
Haskell
It took me an embarrassingly long time to figure out what was going on with this one.
You could go a bit faster by splitting the list into beginning/middle/end parts, but I like the simplicity of this approach.
janAkali@lemmy.sdf.org · 2 pts · 266d
Nim
parts 1 and 2 - easy
For part 3 - When I first looked at the example input - it seemed a bit daunting to solve. But then I had a hunch and decided to check the real input and turns out - I was right! The real input is easier to solve because it's longer than 1000 chars.
This means that there is only 3 possible configurations we care about in repeated input: leftmost section, rightmost section and 998 identical sections in the middle. We solve each individually and sum them.
Another trick I used is looking up mentors with modulo to avoid copying the input.
Full solution at Codeberg: solution.nim
vole@lemmy.world · 2 pts · 262d
Scheme/Guile
Part 3 was a fun little challenge.
Pyro@programming.dev · 2 pts · 259d
Python
Used sliding window for part 3. The off-by-one difference between
iandjtripped me up for a while.