Problem
Ask
Submissions

Problem: Median of Two Sorted Arrays

Medium
30 min
Understand how to find the median of two sorted arrays while meeting O(log(min(m, n))) runtime complexity. This lesson challenges you to assess the problem, design an optimal algorithm, and implement the solution in code, helping you master a key interview question on array manipulation and efficient searching.

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

  • 105-10^5 \leq nums1[i], nums2[i] 105\leq 10^5

Problem
Ask
Submissions

Problem: Median of Two Sorted Arrays

Medium
30 min
Understand how to find the median of two sorted arrays while meeting O(log(min(m, n))) runtime complexity. This lesson challenges you to assess the problem, design an optimal algorithm, and implement the solution in code, helping you master a key interview question on array manipulation and efficient searching.

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

  • 105-10^5 \leq nums1[i], nums2[i] 105\leq 10^5