News for hackers. Stuff that matters.
Re:Why 37signals Doesn't Hire Programmers Based on Brainteasers by mbernstein on Thursday January 05, 2012 @06:33PM (#3431133)
Couple minutes in ruby without using the knowledge of the binomial theorem or coefficients.

  def p(row)
    [1,Range.new(0, row.length - 2).map {|l|     
      row[l] + row[l+1] 
      }, 1].flatten
  end

  a = [1]
  while true
    a = p(a)
    puts a.inspect
  end

edit: fixed formatting, sorry :(

There are no comments on this comment yet.