Median of Two Sorted Arrays
Return the median of two sorted arrays.
Examples
Input: [[1,3],[2]]
Output: 2
Input: [[1,2],[3,4]]
Output: 2.5
Hints
Partition both arrays such that the combined left half contains exactly half of the total elements (or half + 1 for odd lengths).
Adjust partitions to ensure all elements in the left half are ≤ all elements in the right half.
Handle edge cases where one array is significantly smaller than the other by ensuring the partition in the smaller array is valid.
Related Problems
Median of Two Sorted Arrays
Return the median of two sorted arrays.