News for hackers. Stuff that matters.
Re:Why 37signals Doesn't Hire Programmers Based on Brainteasers by z324werwer on Thursday January 05, 2012 @03:27PM (#3430343)
u mad bro, that u had to write so many lines, and yet your code couldn't print out pascal(5000)

u mad?

in ruby,

  def fact(n)
    n == 0 ? 1 : n.downto(1).inject(:*)
    end

  def pascal(n)
   0.upto(n) {|r| print "#{fact(n)/(fact(r)*fact(n - r))} "}
  end

There are no comments on this comment yet.