Max Distance Between pair
class Solution {\n    public int maxDistance(int[] nums1, int[] nums2) {\n\t\n        Brute FOrce Approach -----> Time Limit Exception for long input.\n\t\t\n  
class Solution {\n    public int maxDistance(int[] nums1, int[] nums2) {\n\t\n        Brute FOrce Approach -----> Time Limit Exception for long input.\n\t\t\n        int mx =0;\n        for(int i = 0;i<nums1.length; i++){\n            int diff =0;\n            for(int j = i; j<nums2.length; j++){\n                if(i<=j && nums1[i]<=nums2[j]) diff = (j-i);\n                mx = Math.max(mx,diff);\n            }   \n        }\n        return mx;\n//\n\n         //         Binary Search -----> \n\t\t \n        int mx = 0;\n        for(int i =0; i<nums1.length; i++){\n            int lo = 0;\n            int hi = nums2.length-1;\n            while(lo<=hi){\n                int mid = lo+(hi-lo)/2;\n                if(nums2[mid]>=nums1[i]){\n                    lo = mid+1;\n                }else hi = mid-1;\n            }\n            if(hi<0) continue;\n             mx = Math.max(mx,hi-i);\n        }\n        return mx;\n       \n// \n        \n        //         Two Pointer\n\n        int i = 0;\n        int j = 0;\n        int mx =0;\n        while(i<nums1.length && j<nums2.length){\n         if(nums1[i]>nums2[j])i++;\n         else{\n             mx = Math.max(mx,j-i);\n             j++;\n         }\n        }\n        return mx;\n    }\n}\n***Please upvote if you like***
['Binary Search', 'Java']