Algorithm · Airbnb · Medium
You have a large, unsorted array of integers called nums. Your job is to compute its median efficiently. For an ordered collection: When the length is odd, the median is the lone middle element. When the length is even, the median is the average (mean) of the two middle elements. Because the dataset can be enormous, your algorithm must achieve an amortized time complexity of O(N). Constraints: 1 ≤ nums.length ≤ 10⁵ -2³¹ ≤ nums[i] ≤ 2³¹ - 1 Example 1: Input: nums = [3, 1, 2,…
Checking your access…