Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Codegolf: Pascal's Triangle
Drew Olson
1/25/2007 2:49:00 PM
Hi all!
I've been quite addicted to www.codegolf.com for a while and I'm trying
to skim down my Pascal's Triangle program. The challenge description is
here:
http://codegolf.com/pascal...
. I'm currently at 84 bytes,
but some awesome ruby coders have done it in 43 bytes! Take a look at
the code and let me know if there's anything glaringly obvious I could
do the reduce character count. New lines have been added for
readability, there are no new lines in the true code.
def f(n)
n<1?1:n*f(n-1)
end;
34.times{|i|
puts((0..i).map{|j|f(i)/(f(j)*f(i-j))}*' ')
}
--
Posted via
http://www.ruby-...
.
1 Answer
Erik Veenstra
1/25/2007 5:08:00 PM
0
Not again... ;]
http://www.rubyquiz.com/q...
http://tinyurl....
gegroet,
Erik V. -
http://www.erikve...
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Codegolf: Pascal's Triangle
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password