Simple easy solution, beats 99% ✅✅
\n# Complexity\n- Time complexity: O(n)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(1)\n Add your space complexity here, e.g. O(n) \n\n
\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int maxDistance(vector<int>& nums1, vector<int>& nums2) {\n        int i = 0, j = 0, m = nums1.size(), n = nums2.size();\n        int ans = 0;\n        while(i<m && j<n){\n            if(nums2[j] >= nums1[i]){\n                ans = max(ans,(j-i));\n                j++;\n            }\n            else{\n                i++;\n            }\n        }\n        return ans;\n    }\n};\n```
['Two Pointers', 'C++']