1855. Maximum Distance Between a Pair of Values
On This Page
class Solution:
def maxDistance(self, nums1: List[int], nums2: List[int]) -> int:
m, n = len(nums1), len(nums2)
res = i = j = 0
while i < m:
while j < n and nums1[i] <= nums2[j]:
j += 1
res = max(res, j - i - 1)
i += 1
return res