Coding Challenge

Median of Two Sorted Arrays

Hard
binary-searcharray

Find the median of two sorted arrays in logarithmic time.

Given two sorted arrays, return the median of the combined sorted data in O(log(min(n,m))) time.

Examples

Input: nums1 = [1,3], nums2 = [2]

Output: 2.0

Constraints

  • Arrays may have different lengths
  • At least one array is non-empty

Preparing your coding workspace...