Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re (tilly) 2: PGA Golf, Round 1

by tilly (Archbishop)
on May 24, 2001 at 22:55 UTC ( #83072=note: print w/ replies, xml ) Need Help??


in reply to Re: PGA Golf, Round 1
in thread PGA Golf, Round 1

I had similar solutions. But I improved on hole 3 to 20:

sub hole{map/^(.*?)\1+\z/s,@_}
and my solution for hole 5 was also 29 but somewhat different.
sub hole{$,=pop;$,=$,<$_?$_:$,for@_;$,}
However we can improve hole 5 to 28 taking your solution and applying my trick to it.:
sub hole{$,=pop;$_<$,or$,=$_ for@_;$,}

UPDATE
Oops. My test code put hole 3 in the wrong context. My bad.


Comment on Re (tilly) 2: PGA Golf, Round 1
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (17)
As of 2015-07-02 17:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (44 votes), past polls