Java(Binary Search)-Self Explanatory
simplest way- Ask if you don\'t understand something\n\n\nclass Solution {\n    public int maxDistance(int[] nums1, int[] nums2) {\n        int n=nums1.length,m
simplest way- Ask if you don\'t understand something\n\n```\nclass Solution {\n    public int maxDistance(int[] nums1, int[] nums2) {\n        int n=nums1.length,m=nums2.length,max=0;\n        for(int i=0;i<n;i++){\n            int l=i,r=m-1,mid=0,target=nums1[i],x=-1;\n            while(l<=r){\n                if(nums1[i]>nums2[i]) break;\n                mid=l+(r-l)/2;\n                if(nums2[mid]>=target){\n                    x=mid;\n                    l=mid+1;\n                }\n                else r=mid-1;\n            }\n            //System.out.println(x);\n            max= Math.max(max,x-i);\n        }\n        return max;\n    }\n}\n```
['Binary Search', 'Java']