Skip to content

Latest commit

 

History

History

day-4-binomial-distribution-2

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Day 4: Binomial Distribution II

https://www.hackerrank.com/challenges/s10-binomial-distribution-2

Problem

In this challenge, we go further with binomial distributions.

Task

A manufacturer of metal pistons finds that, on average, 12% of the pistons they manufacture are rejected because they are incorrectly sized. What is the probability that a batch of 10 pistons will contain:

No more than 2 rejects?
At least 2 rejects?

Input Format

A single line containing the following values (denoting the respective percentage of defective pistons and the size of the current batch of pistons):

12 10

Output Format.

Print the answer to each question on its own line:

  1. The first line should contain the probability that a batch of 10 pistons will contain no more than 2 rejects.
  2. The second line should contain the probability that a batch of 10 pistons will contain at least 2 rejects.

Round both of your answers to a scale of 3 decimal places (i.e., 1.234 format).

My Solution