Problem Statement | |||||||||||||
You have been given a int[] vals that is missing one element. Luckily, you know the mean of the entire set (with the missing element present). Using this information, reconstruct the full data set and return the median. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Notes | |||||||||||||
- | The mean of a list of values is their average. The median of a list of values is determined by sorting the list, and then taking the middle element. | ||||||||||||
Constraints | |||||||||||||
- | vals will contain between 2 and 50 elements, inclusive. | ||||||||||||
- | vals will contain an even number of elements. | ||||||||||||
- | Each element of vals will be between -1000 and 1000, inclusive. | ||||||||||||
- | mean will be between -1000 and 1000, inclusive. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
| |||||||||||||
4) | |||||||||||||
|