[Python3] sliding window
\n\nclass Solution:\n    def maxDistance(self, nums1: List[int], nums2: List[int]) -> int:\n        ans = ii = 0 \n        for i, x in enumerate(nums2): \n     
\n```\nclass Solution:\n    def maxDistance(self, nums1: List[int], nums2: List[int]) -> int:\n        ans = ii = 0 \n        for i, x in enumerate(nums2): \n            while ii <= i and ii < len(nums1) and nums1[ii] > nums2[i]: ii += 1\n            if ii < len(nums1) and nums1[ii] <= nums2[i]: ans = max(ans, i - ii)\n        return ans \n```
['Python3']