4. Median of Two Sorted Arrays

Practice Median of Two Sorted Arrays for free on NudgeCode: Hard, Binary Search pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

nums1 and nums2 are each sorted ascending. Return the median of all their values combined: the middle value, or the average of the two middle values when the total count is even. Target O(log(m + n)).

Example

nums1 = [1,3], nums2 = [2]  ->  2.0
nums1 = [1,2], nums2 = [3,4]  ->  2.5

Constraints