Algorithms

Add a reply

Posted by mick 912 days ago:
FWIW, this was my path...

First, I tried calculating it the long way:
n!/(n-k)!k!
70 bytes.

Then I read the wikipedia article about the relationship between (n choose k) and Pascal's triangle.
Pascal's kth element of the nth row is (n k).
65 bytes, but so slow as to fail the tests.

Then I thought back to the Pascal's Triangle challenge earlier in this series. Bingo.
39 bytes.

Anyone trying something different?
Posted by fuliculi 354 days ago:
Hi... I also got a 39 bytes solution.
Seems like many of us hit some kind of wall there.

Are all the solution similar?
Do you use a big integer inside your solution?
Posted by wendelscardua 344 days ago:
I did this instead: (n / k) * ((n-1)/(k-1)) * ((n-2)/(k-2)) ...

Add a reply