Combinations Count
Hard
math
Jane Street
Two Sigma
Citadel
Compute C(n, k) - the number of ways to choose k items from n items. Use dynamic programming to avoid overflow from large factorials.
Example
combinations_count(5, 2)
# => 10
combinations_count(10, 3)
# => 120
Test Cases
Python Editor
Output
Click "Run" to see results...