Sponsored
Use these hints if you're stuck. Try solving on your own first.
The hard part is the median. Write a helper function which finds the k-th element from the sample.
Solve with full IDE support and test cases