Median of Two Sorted Arrays

Try to solve the Median of Two Sorted Arrays problem.

Statement

You’re given two sorted integer arrays, nums1 and nums2, of size mm and nn, respectively. Your task is to return the median of the two sorted arrays.

The overall run time complexity should be O(log(m+n))O(\log (m + n)).

Constraints:

  • nums1.length ==== mm

  • nums2.length ==== nn

  • 0m10000 \leq m \leq 1000

  • 0n10000 \leq n \leq 1000

  • 1m+n20001 \leq m + n \leq 2000

  • 106-10^6 \leq nums1[i], nums2[i] 106\leq 10^6

Examples

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy