Cody

Problem 2770. Probability of Choosing a Red Ball

Solution 544024

Submitted on 10 Dec 2014 by Kevin
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   Pass
%% r1 = 2; b1 = 7; r2 = 5; b2 = 5; prob_correct = 0.2500; assert(isequal(probRedBall(r1,b1,r2,b2),prob_correct))

2   Pass
%% r1 = 0; b1 = 5; r2 = 0; b2 = 5; prob_correct = 0.0000; assert(isequal(probRedBall(r1,b1,r2,b2),prob_correct))

3   Pass
%% r1 = 0; b1 = 3; r2 = 1; b2 = 3; prob_correct = 0.0625; assert(isequal(probRedBall(r1,b1,r2,b2),prob_correct))

Suggested Problems

Community Treasure Hunt

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

Start Hunting!