Java solution | O(M + N)
\n    public int maxDistance(int[] nums1, int[] nums2) {\n        \n        int i=0;\n        int j=0;\n\n        int diff = 0;\n        while(i < nums1.length 
\n    public int maxDistance(int[] nums1, int[] nums2) {\n        \n        int i=0;\n        int j=0;\n\n        int diff = 0;\n        while(i < nums1.length && j < nums2.length)\n        {\n            \n            if(nums2[j] >= nums1[i])\n            {\n                diff = Math.max(diff, j-i);\n                j++;\n            }\n            else\n            {\n                i++;\n            }\n            \n        }\n        \n        return diff;\n    }
['Java']