Menu
Coddy logo textTech

Combination Calculation

Lesson 2 of 3 in Coddy's Interview Coding Challenges - X course.

challenge icon

Challenge

Medium

Write a recursive function named combination to calculate the combination C(n, k), which represents the number of ways to choose k items from n items without regard to order.

The combination formula is given by C(n, k) = n! / (k! * (n - k)!).

Try it yourself

int combination(int n, int k) {
    // Write code here
}

All lessons in Interview Coding Challenges - X

1Challenges

Factorial CalculationCombination CalculationPascal's Triangle