Median O(1)
Start Timer
0:00:00
You’re given a list of sorted integers in which more than 50% of the list is comprised of the same repeating integer.
Write a function to return the median value of the list in computational time and space.
Note: the lists are all non-empty
Example:
Input:
li = [1,2,2]
Output:
median(li) -> 2
.
.
.
.
.
.
.
.
.
Comments