Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: How many triangles does your perl script "see"?

by jdalbec (Deacon)
on Oct 28, 2005 at 01:02 UTC ( [id://503522]=note: print w/replies, xml ) Need Help??


in reply to How many triangles does your perl script "see"?

my @lines = ("AB","ACFI","ADGJ","AE","BCDE","BFHJ","BI","EGHI","EJ","I +J"); foreach my $i ("A".."H") { foreach my $j (++(my $ii = $i) .. "I") { foreach my $k (++(my $jj = $j) .. "J") { print "$i$j$k\n" if 3 == grep {/$i.*$j|$i.*$k| +$j.*$k/} @lines; } } }

Replies are listed 'Best First'.
Re^2: How many triangles does your perl script "see"?
by Skeeve (Parson) on Oct 28, 2005 at 04:50 UTC
    *WOW* The shortest solution! Clean, simple and really cool!

    s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
    +.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2024-04-19 11:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found