Median of Two Sorted Arrays

Solution
class Solution:
    def findMedianSortedArrays(self, nums1: list[int], nums2: list[int]) -> float:
        m, n = len(nums1), len(nums2)
        p1, p2 = 0, 0
        
        def get_min():
            nonlocal p1, p2
            # ... logic to get the next smallest number ...

Time Complexity

O(log(m+n)

Space Complexity

O(log(m+n)