Two pointers O(N)
class Solution {\n    public int maxDistance(int[] nums1, int[] nums2) {\n     \n        int left = 0, right = 0, maxDist = 0;\n        int len1 = nums1.length,
class Solution {\n    public int maxDistance(int[] nums1, int[] nums2) {\n     \n        int left = 0, right = 0, maxDist = 0;\n        int len1 = nums1.length, len2 = nums2.length;\n\n        while(left < len1 && right < len2){\n            \n            if(nums1[left] > nums2[right]){\n                left++;\n            }else{\n                maxDist = Math.max(maxDist, right - left);\n                right++;\n            }\n\n        }\n\n        return maxDist;\n        \n    }\n}\n\n\n
['Java']