You are viewing a single comment's thread. Return to all comments →
This might be useful: https://blog.plover.com/math/choose.html
unsigned choose(unsigned n, unsigned k) { unsigned r = 1; unsigned d; if (k > n) return 0; for (d=1; d <= k; d++) { r *= n--; r /= d; } return r; }
I translated it to Haskell (foldr) and passed all tests.
Seems like cookies are disabled on this browser, please enable them to open this website
Different Ways
You are viewing a single comment's thread. Return to all comments →
This might be useful: https://blog.plover.com/math/choose.html
I translated it to Haskell (foldr) and passed all tests.