:( last test case fails any help !!!!!!!
\nclass Solution {\npublic:\n    \n    \n    int mod=1000000007;\n    \n    int maxSum(vector<int>& nums1, vector<int>& nums2) {\n        auto a=nums1,b=nums2;\
```\nclass Solution {\npublic:\n    \n    \n    int mod=1000000007;\n    \n    int maxSum(vector<int>& nums1, vector<int>& nums2) {\n        auto a=nums1,b=nums2;\n        \n        int curr1=0,curr2=0,res=0;\n        \n        int i=0,j=0;\n        \n        while(i<nums1.size()&&j<nums2.size())\n        {\n            if(a[i]==b[j])\n            {\n                res=(res+(a[i]+max(curr1,curr2))%mod)%mod;\n                curr1=0;\n                curr2=0;\n                i++;j++;\n            }\n            \n            else if(a[i]>b[j])\n            {\n                while(j<b.size()&&a[i]>b[j])\n                {\n                    curr2=(curr2+b[j++])%mod;\n                }\n            }\n            else if(a[i]<b[j])\n            {\n                while(i<a.size()&&a[i]<b[j])\n                {\n                    curr1=(curr1+a[i++])%mod;\n                }\n            }\n            \n        }\n        \n        while(i<a.size())\n        {\n            curr1=(curr1+a[i++])%mod;\n        }\n        \n        while(j<b.size())\n        {\n            curr2=(curr2+b[j++])%mod;\n        }\n        \n        res=(res+(max(curr1,curr2))%mod)%mod;\n        return res;\n        \n    }\n};\n```
[]