C++ 2 Pointers
\nint maxDistance(vector<int>& nums1, vector<int>& nums2) {\n        \n        int i = 0, j = 0;\n        int n = nums1.size(), m = nums2.size(), maxlen = 0;\n 
```\nint maxDistance(vector<int>& nums1, vector<int>& nums2) {\n        \n        int i = 0, j = 0;\n        int n = nums1.size(), m = nums2.size(), maxlen = 0;\n                \n        while(i < n && j < m){\n                 \n            while(j < m && nums1[i] <= nums2[j])\n                j++;\n\n            maxlen = max(maxlen, j-i-1); \n            \n            while(i < n && j < m && nums1[i] > nums2[j])\n                i++;            \n        }\n        \n        return maxlen;\n    }\n}\n```
[]