C++ easy solution || binary search
\nint maxDistance(vector<int>& nums1, vector<int>& nums2) {\n        int n = nums1.size();\n        int maxi =0;\n        for(int i=0;i<n;i++){\n            int
```\nint maxDistance(vector<int>& nums1, vector<int>& nums2) {\n        int n = nums1.size();\n        int maxi =0;\n        for(int i=0;i<n;i++){\n            int num = nums1[i];\n            int ind = binary_search(nums2,num);\n            maxi = max(maxi,ind-i);\n        }\n        return maxi;\n    }\n    int binary_search(vector<int>&nums,int k){\n        int i=0,j=nums.size()-1;\n        while(i<j){\n            int mid = (i+j)/2+1;\n            if(nums[mid] < k) j = mid-1;\n            else i = mid;\n        }\n        return j;\n    }\n```
[]