14
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
this post was submitted on 02 Dec 2024
14 points (100.0% liked)
NotAwfulTech
385 readers
4 users here now
a community for posting cool tech news you don’t want to sneer at
non-awfulness of tech is not required or else we wouldn’t have any posts
founded 1 year ago
MODERATORS
Day 10. I lied about doing this later, I guess.
p1, 2 I accidentally solved 2. before 1.
My initial code was: for every 9, mark that square with a score of 1. Then: for (I = 8, then 7 ... 0) => mark the square with the sum of the scores of the squares around it with a value of i + 1.Except that gives you all the ways to reach 9s from a 0, which is part 2. For part 1, I changed the scores to be sets of reachable 9s, and the score of a square was the size of the set at that position.
10 commentary
Yeah basically if you were doing DFS and forgot to check if you'd already visited the next node you were solving for pt2, since the rule about the next node always having a value of +1 compared to the current one was already preventing cyclic paths.10 Code
Hardly a groundbreaking implementation but I hadn't posted actual code in a while sore: 10 commentary
apparently "everyone" did this. Me too
re:10
Mwahaha I'm just lazy and did are "unique" (single word dropped for part 2) of start/end pairs.