The 90th Percentile Response Time
Halcyon Bank's site reliability team refuses to judge an API by its average response time. An average hides the slow tail, and it is the slow tail that customers phone up about. The service agreement is written against the 90th percentile instead. The team's convention, which matters because percentile figures are defined differently by different tools, is this: line the readings up in order, take the point nine tenths of the way along, and where that point falls between two readings, blend those two in proportion to how far between them it lies rather than rounding to the nearer one.
Task: Print the 90th percentile of the response times.
Input
The first line holds a single integer n, the number of readings. Each of the next n lines holds one response time in milliseconds, which may carry decimals.
Output
One line holding the 90th percentile with exactly one digit after the decimal point.
Example:
Input:
10
100
105
110
95
120
98
102
115
108
300
Output:
138.0
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