Cody

Problem 2796. Find out Binomial coefficient

Solution 3400508

Submitted on 26 Oct 2020
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
n=2; r=0.25; y_correct = 1.3719; assert(abs(bi_coff(n,r)-y_correct)<0.0001)

Unrecognized function or variable 'k'. Error in bi_coff (line 2) y = gamma(n+1) / (gamma(r+1) / gamma(n-k+1)) Error in Test1 (line 4) assert(abs(bi_coff(n,r)-y_correct)<0.0001)

2   Fail
n=2; r=2; y_correct = 1; assert(abs(bi_coff(n,r)-y_correct)<0.0001)

Unrecognized function or variable 'k'. Error in bi_coff (line 2) y = gamma(n+1) / (gamma(r+1) / gamma(n-k+1)) Error in Test2 (line 4) assert(abs(bi_coff(n,r)-y_correct)<0.0001)

3   Fail
n=5; r=3.5; y_correct = 7.7607; assert(abs(bi_coff(n,r)-y_correct)<0.0001)

Unrecognized function or variable 'k'. Error in bi_coff (line 2) y = gamma(n+1) / (gamma(r+1) / gamma(n-k+1)) Error in Test3 (line 4) assert(abs(bi_coff(n,r)-y_correct)<0.0001)

4   Fail
n=5; r=1.1; y_correct = 5.5483; assert(abs(bi_coff(n,r)-y_correct)<0.0001)

Unrecognized function or variable 'k'. Error in bi_coff (line 2) y = gamma(n+1) / (gamma(r+1) / gamma(n-k+1)) Error in Test4 (line 4) assert(abs(bi_coff(n,r)-y_correct)<0.0001)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!