Median of Two Sorted Arrays - aloalgo

Median of Two Sorted Arrays

Hard

You are given two sorted arrays nums1 and nums2 of size m and n respectively.

Your task is to find the median of the two sorted arrays.

Return the calculated median as an integer rounded down.

Example 1

Inputs
nums1 = [1, 2]
nums2 = [10]
Output
2
Explanation:

The merged array is [1, 2, 10] and its median is 2.

Example 2

Inputs
nums1 = [1, 2]
nums2 = [3, 10]
Output
2
Explanation:

The merged array is [1, 2, 3, 10] and its median is (2 + 3) / 2 = 2.5. Rounded down, it is 2.

Loading...
Inputs
nums1 = [1, 2]
nums2 = [10]
Output
2

Hello! I am your ✨ AI assistant. I can provide you hints, explanations, give feedback on your code, and more. Just ask me anything related to the problem you're working on!