Quest 8: The Art of Connection

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

  • mykl@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    9 days ago

    Uiua

    Just a dirty great hack and a few minutes of toasty CPU for part3 with live data.

    "1,5,2,6,8,4,1,7,3"
    ⊜⋕⊸≠@,
    &p /+=⊃(⧈₂(⌵/-)|÷2/↥) # Part1 --> 4
    
    "1,5,2,6,8,4,1,7,3,5,7,8,2"
    ⊜⋕⊸≠@,
    Knot  ← (⊃(=¯|=)∩⌞(±-)⊙°⊟)
    Knots ← /↧/↥↯∞_2[∩⌟Knot]°⊟
    ⧈₂⍆
    &p /+≡(/+≡Knots¤°⊂↙¯)⊙¤+1↘2⇡⊸⧻ # Part 2 --> 21
    
    "1,5,2,6,8,4,1,7,3,6"
    ⊜⋕⊸≠@,
    ⊃(⧅<2+1⇡⧻◴|⧈₂⍆)            # Possible cuts, existing strings.
    /↥+⊃(≡˜∊⊙¤|≡(/+≡Knots¤)⊙¤) # Part3 --> 7