Hacker News new | past | comments | ask | show | jobs | submit login

Mathematician's solution: the entries in Pascal's triangle are combinations (n-over-k), which can be calculated directly: n-over-k = n!/((n - k)!k!). (If you want to be even faster, use Stirling's approximation to the factorial.)



Yes, neatly circumventing all of the clever algorithmic complexity optimisation that the interviewer is apparently looking for, and making this an even worse interview question.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: