this post was submitted on 13 Nov 2025
3 points (63.6% liked)

Advent Of Code

1122 readers
3 users here now

An unofficial home for the advent of code community on programming.dev! Other challenges are also welcome!

Advent of Code is an annual Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be solved in any programming language you like.

Everybody Codes is another collection of programming puzzles with seasonal events.

EC 2025

AoC 2024

Solution Threads

M T W T F S S
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25

Rules/Guidelines

Relevant Communities

Relevant Links

Credits

Icon base by Lorc under CC BY 3.0 with modifications to add a gradient

console.log('Hello World')

founded 2 years ago
MODERATORS
 

Quest 7: Namegraph

  • 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/

you are viewing a single comment's thread
view the rest of the comments
[–] mykl@lemmy.world 2 points 6 days ago* (last edited 6 days ago)

Uiua

There's probably a good solution hiding in here, but this ain't it. I originally went for the combinatoric approach for part 3, but it was giving me an answer that turned out to be out by 8, so brute force came to the rescue.

Prep ← (
  ⊜□⊸≠@\n
  Pairs ← ≡⊂⊓(¤|⊜∘⊸≠@,)∩°□°⊟
  ⊃(≡(□Pairs⊜□⊸(¬⦷" > ")°□)↘1|⊜□⊸≠@,°□⊢)
  ↘¯1∧(⊂°□) ⊙["  "]
)
"Oronris,Urakris,Oroneth,Uraketh\nr > a,i,o\ni > p,w\nn > e,r\no > n,m\nk > f,r\na > k\nU > r\ne > t\nO > r\nt > h\n"
°□⊢▽⊸≡(/↧∊⊙(⧈₂∘°□))¤Prep # Part1 --> "Oroneth"
"Xanverax,Khargyth,Nexzeth,Helther,Braerex,Tirgryph,Kharverax\nr > v,e,a,g,y\na > e,v,x,r\ne > r,x,v,t\nh > a,e,v\ng > r,y\ny > p,t\ni > v,r\nK > h\nv > e\nB > r\nt > h\nN > e\np > h\nH > e\nl > t\nz > e\nX > a\nn > v\nx > z\nT > i\n"
/++1⊚≡(/↧∊⊙(⧈₂∘°□))¤Prep # Part2 --> 23
P ← Prep"Khara,Xaryt,Noxer,Kharax\nr > v,e,a,g,y\na > e,v,x,r,g\ne > r,x,v,t\nh > a,e,v\ng > r,y\ny > p,t\ni > v,r\nK > h\nv > e\nB > r\nt > h\nN > e\np > h\nH > e\nl > t\nz > e\nX > a\nn > v\nx > z\nT > i\n"
Keys  ← ⊙◌P
Names ← ◌ P
GoodNames ← (
  ˜▽Names≡(/↧∊⊙(⧈₂∘°□))¤P                 # Remove names that fail part2
  ▽⊸(¬≡(/+≡(⨬(0|≍∩⌞↙↧◡∩⧻∩°□)>◡∩(⧻°□))))⊸¤ # Exclude all names that are prefixes of others.
)
# Build up all names and count them. Yuk, slower, but righter.
⊙0GoodNames
≡◇([∘]
   ⍢(
    /◇⊂≡◇(□≡˜⊂⊙¤≡⊣▽⤚(=≡⊢)Keys⊸⊣) # Add next chars, collect.
    ⨬(∘|⊙+⟜⧻)⊸(≥7⧻⊢)             # Add to counts if long enough.
  | <11⊣△)
   ◌ # We don't need the data, just the counts.
)
/+