Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Advent of Code, Day 15, golfed!

by tybalt89 (Monsignor)
on Dec 18, 2021 at 02:44 UTC ( [id://11139698]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    push@a,@r=/./g}{print$s{-1+map{$u{$_}||=$a[$_]+$s{$g-1}for
    grep$a[$_]*!$s{$_},$g+@r,$g-!!($g%@r),$g-@r*($g>=@r),++$g*!!($g
    %@r);($g)=sort{$u{$a}-$u{$b}}keys%u;$s{$g}=delete$u{$g}}@a}
    
  2. or download this
    # problem description says "resembles a square"
    push@a,/./g}{print$s{-1+map{$u{$_}||=$a[$_]+$s{$g-1}for
    grep$a[$_]*!$s{$_},$g+$.,$g-!!($g%$.),$g-$.*($g>=$.),++$g*!!($g
    %$.);($g)=sort{$u{$a}-$u{$b}}keys%u;$s{$g}=delete$u{$g}}@a}
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11139698]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-03-28 21:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found