Median of Two Sorted Arrays Problem

Median of Two Sorted Arrays Problem — ExecCode Hard DSA Practice

Solve the Median of Two Sorted Arrays problem on ExecCode. Free online hard DSA practice in Binary Search. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Given two sorted arrays nums1 and nums2 of size m and n, return the median of the two sorted arrays in O(log(m+n)). For Median of Two Sorted Arrays, focus on the exact input variables, return only the requested value, and preserve the required time complexity for the intended pattern.

Examples

Input nums1 = [1, 3], nums2 = [2]; Output 2.0

Constraints

1 ≤ n ≤ 10^5

Practice Median of Two Sorted Arrays free on ExecCode. Browse DSA problems, topic map, and placement guides.