Given two sorted arrays nums1 and nums2 of size m and n, return the median of the two sorted arrays. The overall runtime complexity must be O(log(m+n)).
Example 1:
Input: 1 3 2 Output: 2.00000
Example 2:
Input: 1 2 3 4 Output: 2.50000
Constraints:
- 0 ≤ m, n ≤ 1000
- At least one array is non-empty
- -10⁶ ≤ nums1[i], nums2[i] ≤ 10⁶
Input format: First line: space-separated nums1. Second line: space-separated nums2.
Output format: Median rounded to 5 decimal places.