All problems

The 90th Percentile Cutoff

easyPythonDescriptive Statistics

Legal at Whetcode Cloud is drafting the service-level agreement for the public API and needs a single number to put in it: the latency the company will promise that nine out of every ten requests beat. An average is no use here - a figure that only half the traffic beats is not a promise anyone will sign.

Every endpoint in the contract gets its own line, so the same calculation is run again for each one against that endpoint's sampled response times.

When the 90% mark does not land on a measured request - which is most of the time - the convention has to be pinned: interpolate linearly between the two neighbouring sorted values, the default your numeric library uses, rather than snapping to the nearest measured time.

Task: Print the 90th percentile of the sampled response times, rounded to 2 decimals.

Input

One line holding the sampled response times in milliseconds, separated by single spaces, in no particular order. Each is a whole number and there are at least two of them.

Output

One line holding the 90th percentile, rounded to 2 decimals and printed the way Python prints a float - 95.5, and 46.0 rather than 46.00.

Example:

Input:
55 60 65 70 75 80 85 90 95 100

Output:
95.5

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…