Search
⌘K

Leetcode 1855. Maximum Distance Between a Pair of Values

Given two non-increasing arrays, find the maximum index distance j - i for a pair (i, j) with i <= j and nums1[i] <= nums2[j]; the monotonicity of both arrays lets you efficiently search valid pairs (e.g., via two pointers or binary search) for lengths up to 1e5.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.