two pointer js
\nvar maxDistance = function(nums1, nums2) {\n    \n    let maxDistance = Math.max();\n    \n    let ptr1 = 0;\n    let ptr2 = 0;\n        \n        \n    while
```\nvar maxDistance = function(nums1, nums2) {\n    \n    let maxDistance = Math.max();\n    \n    let ptr1 = 0;\n    let ptr2 = 0;\n        \n        \n    while(ptr2 < nums2.length){\n\n        if(nums1[ptr1] <= nums2[ptr2]){\n            maxDistance = Math.max(maxDistance, ptr2 - ptr1);\n            ptr2++;\n        } else {\n            ptr1++;\n        }\n        \n        while(ptr1 > ptr2){\n            ptr2++;\n        }  \n        \n    }\n\n    return maxDistance === Math.max() ? 0 : maxDistance;\n    \n};\n```
['JavaScript']