Median of Two Sorted Arrays
Hard · Binary Search · about 35 minutes
Asked at Google, Amazon, Meta, Microsoft, Bloomberg, Apple, eBay, Walmart Global Tech, Wayfair, Etsy, Shopee, Flipkart, Zalando.
nums1 (length m) and nums2 (length n) are each sorted ascending, and at least one is non-empty. Return the median of all m + n values taken together, in O(log(min(m, n))) time.