Comment Comment by exact_string You can use the median of medians with quickselect to guarantee the O(N) time complexity. parent exact_string 4 years ago