100% - 0ms - Dcode
\nclass Solution {\n    public int maxDistance(int[] nums1, int[] nums2) {\n        int i=0,j=0;\n        int n=nums1.length;\n        int m=nums2.length;\n    
```\nclass Solution {\n    public int maxDistance(int[] nums1, int[] nums2) {\n        int i=0,j=0;\n        int n=nums1.length;\n        int m=nums2.length;\n        int max=0;\n        while(i<n && j<m){\n            if(nums1[i]>nums2[j])\n                i++;\n            else{\n                max=Math.max(max,j-i);                \n                j++;\n            }\n        }\n        return max;\n    }\n}\n```
['Java']