News for hackers. Stuff that matters.
Re:Why 37signals Doesn't Hire Programmers Based on Brainteasers by Bootvis on Thursday January 05, 2012 @03:15PM (#3430291)
I'm just surprised nobody has mentioned calculating the solution directly using factorials or some builtin n choose k function.
Re:Why 37signals Doesn't Hire Programmers Based on Brainteasers by derefr on Thursday January 05, 2012 @10:41PM (#3431842)
Or the even-less-computationally-intensive algorithm: http://en.wikipedia.org/wiki/Pascals_triangle#Calculating_an...
Re:Why 37signals Doesn't Hire Programmers Based on Brainteasers by lightcatcher on Friday January 06, 2012 @03:08AM (#3432503)
Thats what dspeyer did here: http://news.ycombinator.com/item?id=3431687 .

For an algorithms heavy job, I would hope a candidate would be able to derive this equation with a little guidance (ie, reminding them about n choose k and how to write that with factorials)

Re:Why 37signals Doesn't Hire Programmers Based on Brainteasers by Bootvis on Friday January 06, 2012 @01:12AM (#3432223)
Very nice but expecting the candidate to know that much about Pascals triangle upfront seems a bit too much ;)
Re:Why 37signals Doesn't Hire Programmers Based on Brainteasers by dspeyer on Thursday January 05, 2012 @09:51PM (#3431711)
Factorials risk integer overflow in the intermediate calculations, though something similar can work.
Re:Why 37signals Doesn't Hire Programmers Based on Brainteasers by Bootvis on Friday January 06, 2012 @01:10AM (#3432218)
Yes, it seems a number of optimizations are possible. At least it is not necessary to calculate n!. Depending on the job discussing these strategies and whether they are worthwhile for some real world problem can be quite interesting.