C++ 2 pointer Solution 97% Simple Solution
\nclass Solution {\npublic:\n    int maxSum(vector<int>& nums1, vector<int>& nums2) {\n        long long num1sum=0,num2sum=0,globalsum=0,i=0,j=0,n=nums1.size(),
```\nclass Solution {\npublic:\n    int maxSum(vector<int>& nums1, vector<int>& nums2) {\n        long long num1sum=0,num2sum=0,globalsum=0,i=0,j=0,n=nums1.size(),m=nums2.size();\n        \n        while(i<n && j<m){\n            if(nums1[i]<nums2[j])\n                num1sum+=nums1[i++];\n                \n            else if(nums1[i]>nums2[j])\n                num2sum+=nums2[j++];\n            \n                else{\n                    globalsum += max(num1sum,num2sum) + nums1[i];\n                    num1sum=0;\n                    num2sum=0;\n                    i++;\n                    j++;\n                }\n        \n        }\n        \n        while (i < n)  num1sum += nums1[i++];\n            while (j < m)  num2sum+= nums2[j++];\n         globalsum += max(num1sum,num2sum);\n            return globalsum % 1000000007;\n    }\n};\n```
['Two Pointers', 'C', 'Merge Sort', 'C++']