Hackerrank is my latest amazing and scary discovery. It’s amazing because I get to solve a problem with ready test cases and I can submit my solutions unlimited time and moreover I get some points on submission. Well, it’s scary as I really struggled at the warmup exercise when I was expecting to finish in a couple of mins!
The problem is here:
This exercise is to calculate the Mean, Median, Mode, Standard Deviation, and Confidence Interval for the Mean. Below is the basic summary:
Mean (m): The average of all the integers.
Median: In case, the number of integers is odd, the middle element; else, the average of the middle two elements.
Mode: The element(s) which occurs most frequently. If multiple elements satisfy this criterion, Mode is the numerically smallest one.
Standard Deviation (SD): Square root of the average squared distance from the mean.
sd = √(Σ(xi – μ)² /n)
where xi = each element in the sample
μ = the mean
n = Sample Size
Confidence Interval for the mean: A 95% confidence interval is a range of values that we can be 95% certain contains the true mean of the population.
CI = μ ± z * σ/√n
where μ= the Mean
z = z* value from the standard normal distribution
σ = the Standard Deviation
n = Sample Size
Example: z* values for various Confidence Levels
Confidence Level z* value
——————————————————
80 % 1.28
90% 1.645
95% 1.96
Okay, now the code part:
Sagar
I just read you blog, It’s very knowledgeable & helpful.
i am also blogger
click here to visit my blog आयुर्वेदिक इलाज