C++ || EASY || Two Pointers || TC=O(n) && SC=O(1)
Intuition\nAs both the array are in decreasing order;\nSo we know the that if we take an element form nums1 , and find its it\'s insertion point in array nums2 
# Intuition\nAs both the array are in decreasing order;\nSo we know the that if we take an element form nums1 , and find its it\'s insertion point in array nums2 without breaking sorting manner we can get the longest distance for that point;\nWhat i mean by insertion point i.e where it can be add to maintain sorting manner\nFor this we can go for 2 pointers; \n\n# Approach\nWe will take 2 pointer lets assume p1 & p2;\nif(nums1[p1]>nums2[p2]) p1++;\notherwise we will store the max value of p2-p1 and increase p2 by 1\nSo getting index upto which  point its nums2[p2]>nums1[p1];\n\n# Complexity\n- Time complexity:\nO(n*m)\n\n- Space complexity:\nO(1)\n\n# Code\n```\nclass Solution {\npublic:\n    int maxDistance(vector<int>& nums1, vector<int>& nums2) {\n        int n=nums1.size();\n        int ans=0,p1=0,p2=0;\n        while(p1<nums1.size() && p2<nums2.size()){\n            if(nums1[p1]>nums2[p2])\n            p1++;\n            else{\n                ans=max(ans,p2-p1);\n                p2++;\n            }\n        }\n        return ans;\n    }\n};\n```
['Two Pointers', 'C++']