Please enter your email address or userHandle.
Given an array arr of N integers, calculate the median
Input: N = 5
arr = 90 100 78 89 67
Explanation: After sorting the array
middle element is the median
Input: N = 4
arr = 56 67 30 79â€‹
Explanation: In case of even number of
elemebts average of two middle elements
is the median
You don't need to read or print anything. Your task is to complete the function find_median() which takes the array as input parameter and returns the floor value of the median.
Expected Time Complexity: O(n * log(n))
Expected Space Complexity: O(1)
1 <= Length of Array <= 100
1 <= Elements of Array <= 100
We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?
Login to access your submissions.
Please choose 'ReadOnlyMode' if you needn't to 'Edit' the problem e.g. viewing OJ's solution, TestCase Files (TCFs), TimeLimit etc.