Variance of Server Response Sizes
The platform team at Whetcode Cloud is sizing a fixed-length buffer for the API gateway. What decides the size is not how big an average response is, but how much the responses jump around: a consistent endpoint can be given a tight buffer, an erratic one cannot.
The sizing script is run once per endpoint, so it is handed the payload sizes for whichever endpoint is being reviewed. Whatever it receives is the complete set of responses for that endpoint's sample window - not a sample drawn from a larger stream - so treat the numbers as the whole population.
Task: Print the population variance of the payload sizes. Print the value as it comes out; the graded windows need no rounding step.
Input
One line holding the payload sizes in KB, separated by single spaces. Each size is a whole number and there are at least two of them.
Output
One line holding the population variance as a float - 4.0, never 4.
Example:
Input:
2 4 4 4 5 5 7 9
Output:
4.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